too many line continuations แก้ไขได้ยังไงบ้างครับ
Posted: Wed Jul 26, 2023 2:52 pm
รบกวนด้วยครับ ผมอยากเพิ่ม putstr ให้มันรันไปได้อีกเรื่อยๆ ไม่กำหนด column ได้ไหมครับ ผมต้องการแปลง file excel ให้เป็น xml ครับ
Sub MXBONDS1()
Dim Handle As Integer, File_Name As String
Dim Row As Long, PutStr As String
File_Name = "\\stmfssap1\Private\OSG\TMO\BD\0001-TEST MACRO BONDS TO BN LITE\BONDS PACS-009.xml"
Handle = FreeFile
If Dir(File_Name) <> "" Then Kill File_Name
Open File_Name For Binary As Handle
For Row = 1 To 100
PutStr = Range("A" & Row).Text & "" & _
Range("B" & Row).Value & "" & _
Range("C" & Row).Text & "" & _
Range("D" & Row).Value & "" & _
Range("E" & Row).Text & "" & _
Range("F" & Row).Value & "" & _
Range("G" & Row).Text & "" & _
Range("H" & Row).Value & "" & _
Range("I" & Row).Text & "" & _
Range("J" & Row).Value & "" & _
Range("K" & Row).Text & "" & _
Range("L" & Row).Value & "" & _
Range("M" & Row).Text & "" & _
Range("N" & Row).Value & "" & _
Range("O" & Row).Text & "" & _
Range("P" & Row).Value & "" & _
Range("Q" & Row).Text & "" & _
Range("R" & Row).Value & "" & _
Range("S" & Row).Text & "" & _
Range("T" & Row).Value & "" & _
Range("U" & Row).Text & "" & _
Range("V" & Row).Value & "" & _
Range("W" & Row).Text & "" & _
Range("X" & Row).Value & "" & _
Range("Y" & Row).Text & vbCrLf
Put Handle, , PutStr
Next
Close Handle
MsgBox "BONDS PACS-009 OK"
End Sub
Sub MXBONDS1()
Dim Handle As Integer, File_Name As String
Dim Row As Long, PutStr As String
File_Name = "\\stmfssap1\Private\OSG\TMO\BD\0001-TEST MACRO BONDS TO BN LITE\BONDS PACS-009.xml"
Handle = FreeFile
If Dir(File_Name) <> "" Then Kill File_Name
Open File_Name For Binary As Handle
For Row = 1 To 100
PutStr = Range("A" & Row).Text & "" & _
Range("B" & Row).Value & "" & _
Range("C" & Row).Text & "" & _
Range("D" & Row).Value & "" & _
Range("E" & Row).Text & "" & _
Range("F" & Row).Value & "" & _
Range("G" & Row).Text & "" & _
Range("H" & Row).Value & "" & _
Range("I" & Row).Text & "" & _
Range("J" & Row).Value & "" & _
Range("K" & Row).Text & "" & _
Range("L" & Row).Value & "" & _
Range("M" & Row).Text & "" & _
Range("N" & Row).Value & "" & _
Range("O" & Row).Text & "" & _
Range("P" & Row).Value & "" & _
Range("Q" & Row).Text & "" & _
Range("R" & Row).Value & "" & _
Range("S" & Row).Text & "" & _
Range("T" & Row).Value & "" & _
Range("U" & Row).Text & "" & _
Range("V" & Row).Value & "" & _
Range("W" & Row).Text & "" & _
Range("X" & Row).Value & "" & _
Range("Y" & Row).Text & vbCrLf
Put Handle, , PutStr
Next
Close Handle
MsgBox "BONDS PACS-009 OK"
End Sub