Hello, Everyone,
I’m trying to export two of the five worksheets in my Excel workbook as csv files. I have the following code, which works a charm:
Dim wsXXX As Worksheet, wsYYY As Worksheet
Set wsXXX = Worksheets("XXX")
Set wsYYY = Worksheets("YYY")
strFilenameXXX = "XXX-ABC" & "DEF-" & Year(Date) & Format(Month(Date), "00") & Format(Day(Date), "00")
strFilenameYYY = "XXX-ABC" & "DEF-" & Year(Date) & Format(Month(Date), "00") & Format(Day(Date), "00")
wsXXX.SaveAs strFilenameXXX & ".csv", xlCSV
wsYYY.SaveAs strFilenameYYY & ".csv", xlCSV
But once these lines of code have run, a couple of things go very wrong
* First, within my workbook, the two worksheets have been renamed as strFilenameYYY
* Second, my entire workbook has been renamed strFilenameYYY
How can I export the two worksheets without changing their names within the workbook and the name of the workbook itself?
Thanks!
Vincent
Bookmarks