Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public 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
- ' Store current details for the workbook
- SaveToDirectory = "C:temp"
- For Each WS In ThisWorkbook.Worksheets
- WS.SaveAs SaveToDirectory & WS.Name, xlCSV
- Next
- Application.DisplayAlerts = False
- ThisWorkbook.SaveAs filename:=CurrentWorkbook, FileFormat:=CurrentFormat
- Application.DisplayAlerts = True
- ' Temporarily turn alerts off to prevent the user being prompted
- ' about overwriting the original file.
- End Sub
- ThisDate = Format(Now(), "ddmmmyy")
- WS.SaveAs SaveToDirectory & WS.Name & WS.Cells(2,2) & ThisDate , xlCSV
- Public 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
- ' Store current details for the workbook '
- ThisDate = Format(Now(), "ddmmmyy")
- SaveToDirectory = "C:temp"
- For Each WS In ThisWorkbook.Worksheets
- WS.SaveAs SaveToDirectory & WS.Name & ThisDate & WS.Cells(2,2) , xlCSV
- Next
Add Comment
Please, Sign In to add comment