I'm trying to create CSV files from an Excel workbook. I need to create a file for each worksheet in the workbook, but the number of worksheets varies from workbook to workbook.
I know I can open the workbook, count the number of sheets in it and create a Do Loop for each worksheet, I just don't know how to move on to the next worksheet, after I finished with the previous one.
Here's a part of my code:
lngSheetCount = objExcel.Sheets.Count
Set objExcel_Sheet = objExcel.ActiveSheet
Do Until x = lngSheetCount
objExcel_Sheet.SaveAs FileName:=objExcel_Sheet.Name, FileFormat:=xlCSV, CreateBackup:=False
x = x + 1
Move to next sheet?
Loop
Thanks!
Kelly
I know I can open the workbook, count the number of sheets in it and create a Do Loop for each worksheet, I just don't know how to move on to the next worksheet, after I finished with the previous one.
Here's a part of my code:
lngSheetCount = objExcel.Sheets.Count
Set objExcel_Sheet = objExcel.ActiveSheet
Do Until x = lngSheetCount
objExcel_Sheet.SaveAs FileName:=objExcel_Sheet.Name, FileFormat:=xlCSV, CreateBackup:=False
x = x + 1
Move to next sheet?
Loop
Thanks!
Kelly