Chcę wyeksportować plik programu Excel jako plik CSV za pomocą makra, ale mój kod eksportuje tylko nagłówek. Jak wyeksportować pełne dane?
Oto mój kod:
Sub CSVFile()
Dim My_filenumber As Integer
Dim logSTR As String
My_filenumber = FreeFile
logSTR = logSTR & Cells(1, "A").Value & " , "
logSTR = logSTR & Cells(1, "B").Value & " , "
logSTR = logSTR & Cells(1, "C").Value & " , "
logSTR = logSTR & Cells(1, "D").Value & " , "
logSTR = logSTR & Cells(1, "E").Value & " , "
logSTR = logSTR & Cells(1, "F").Value & " , "
logSTR = logSTR & Cells(1, "G").Value & " , "
logSTR = logSTR & Cells(1, "H").Value & " , "
logSTR = logSTR & Cells(1, "I").Value & " , "
logSTR = logSTR & Cells(1, "J").Value & " , "
logSTR = logSTR & Cells(1, "K").Value & " , "
logSTR = logSTR & Cells(1, "L").Value & " , "
logSTR = logSTR & Cells(1, "M").Value
Open "C:\Users\folder\Sample.csv" For Append As #My_filenumber
Print #My_filenumber, logSTR
Close #My_filenumber
End Sub
microsoft-excel
macros
csv
export
użytkownik389737
źródło
źródło