Powiadomienia
Wyczyść wszystko
BugOverflow
1
Wpisy
1
Użytkownicy
0
Reactions
2,469
Widoki
0
25/09/2015 4:24 pm
Rozpoczynający temat
Excel, VBA : auto save to CSV with semicolon
1 odpowiedź
0
25/09/2015 4:26 pm
Rozpoczynający temat
Use Local:=True – it’s depend on your system regional settings and separator field
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
Sub SaveWorksheetsAsCsv() Dim WS As Excel.Worksheet Dim SaveToDirectory As String Dim CurrentWorkbook As String Dim CurrentFormat As Long CurrentWorkbook = ThisWorkbook.FullName CurrentFormat = ThisWorkbook.FileFormat SaveToDirectory = "C:test" For Each WS In ThisWorkbook.Worksheets Sheets(WS.name).Copy ActiveWorkbook.SaveAs Filename:=SaveToDirectory & "questions.csv", FileFormat:=xlCSV, Local:=True ActiveWorkbook.Close savechanges:=False ThisWorkbook.Activate Next Application.DisplayAlerts = False ThisWorkbook.SaveAs Filename:=CurrentWorkbook, FileFormat:=CurrentFormat Application.DisplayAlerts = True End Sub |
Sub SaveWorksheetsAsCsv() Dim WS As Excel.Worksheet Dim SaveToDirectory As String Dim CurrentWorkbook As String Dim CurrentFormat As Long CurrentWorkbook = ThisWorkbook.FullName CurrentFormat = ThisWorkbook.FileFormat SaveToDirectory = "C:test" For Each WS In ThisWorkbook.Worksheets Sheets(WS.name).Copy ActiveWorkbook.SaveAs Filename:=SaveToDirectory & "questions.csv", FileFormat:=xlCSV, Local:=True ActiveWorkbook.Close savechanges:=False ThisWorkbook.Activate Next Application.DisplayAlerts = False ThisWorkbook.SaveAs Filename:=CurrentWorkbook, FileFormat:=CurrentFormat Application.DisplayAlerts = True End Sub