Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save active worksheet to CSV file
Excuse me, but I am not profficient in Excel macro programming, but
I need some quick help in editing a macro I recorded to save the active worksheet to a csv file with the sheetname + "_levels". I have code that works for a specific sheet, but I want a general macro that will work with the active sheet. Here is the specific code: Sub SaveAsBmTopo_LevelsCsv() ' ' SaveAsToBmTopoCsv Macro ' Save Bm_topo sheet to bmtopo_levels.csv Sheets("bmtopo").Select ActiveWorkbook.SaveAs Filename:= _ "G:\Standards\levels\bmtopo_levels.csv", FileFormat:=xlCSV _ , CreateBackup:=False Workbooks.Open Filename:= _ "G:\Standards\levels\_std_levels.xls" Workbooks("bmtopo_levels.csv").Close SaveChanges:=False End Sub I suspect that I need some sort of variable in place of "bmtopo", but I can't find any info in the online Help and I don't know the syntax to add that variable to "_levels". TIA, Scott |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save active worksheet to CSV file
Try
myname = activesheet.name ActiveWorkbook.SaveAs Filename:= _ "G:\Standards\levels\" & myname & "_levels.csv", FileFormat:=xlCSV Ole "Scott" wrote in message ... Excuse me, but I am not profficient in Excel macro programming, but I need some quick help in editing a macro I recorded to save the active worksheet to a csv file with the sheetname + "_levels". I have code that works for a specific sheet, but I want a general macro that will work with the active sheet. Here is the specific code: Sub SaveAsBmTopo_LevelsCsv() ' ' SaveAsToBmTopoCsv Macro ' Save Bm_topo sheet to bmtopo_levels.csv Sheets("bmtopo").Select ActiveWorkbook.SaveAs Filename:= _ "G:\Standards\levels\bmtopo_levels.csv", FileFormat:=xlCSV _ , CreateBackup:=False Workbooks.Open Filename:= _ "G:\Standards\levels\_std_levels.xls" Workbooks("bmtopo_levels.csv").Close SaveChanges:=False End Sub I suspect that I need some sort of variable in place of "bmtopo", but I can't find any info in the online Help and I don't know the syntax to add that variable to "_levels". TIA, Scott |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save active worksheet to CSV file
Thanks, I'll try that.
-- Scott "Ole Michelsen" wrote in : Try myname = activesheet.name ActiveWorkbook.SaveAs Filename:= _ "G:\Standards\levels\" & myname & "_levels.csv", FileFormat:=xlCSV Ole "Scott" wrote in message ... Excuse me, but I am not profficient in Excel macro programming, but I need some quick help in editing a macro I recorded to save the active worksheet to a csv file with the sheetname + "_levels". I have code that works for a specific sheet, but I want a general macro that will work with the active sheet. Here is the specific code: Sub SaveAsBmTopo_LevelsCsv() ' ' SaveAsToBmTopoCsv Macro ' Save Bm_topo sheet to bmtopo_levels.csv Sheets("bmtopo").Select ActiveWorkbook.SaveAs Filename:= _ "G:\Standards\levels\bmtopo_levels.csv", FileFormat:=xlCSV _ , CreateBackup:=False Workbooks.Open Filename:= _ "G:\Standards\levels\_std_levels.xls" Workbooks("bmtopo_levels.csv").Close SaveChanges:=False End Sub I suspect that I need some sort of variable in place of "bmtopo", but I can't find any info in the online Help and I don't know the syntax to add that variable to "_levels". TIA, Scott |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save active worksheet to CSV file
Yessiree, that did do it.
Thanks Ole ! -- Scott "Ole Michelsen" wrote in : Try myname = activesheet.name ActiveWorkbook.SaveAs Filename:= _ "G:\Standards\levels\" & myname & "_levels.csv", FileFormat:=xlCSV Ole "Scott" wrote in message ... Excuse me, but I am not profficient in Excel macro programming, but I need some quick help in editing a macro I recorded to save the active worksheet to a csv file with the sheetname + "_levels". I have code that works for a specific sheet, but I want a general macro that will work with the active sheet. Here is the specific code: Sub SaveAsBmTopo_LevelsCsv() ' ' SaveAsToBmTopoCsv Macro ' Save Bm_topo sheet to bmtopo_levels.csv Sheets("bmtopo").Select ActiveWorkbook.SaveAs Filename:= _ "G:\Standards\levels\bmtopo_levels.csv", FileFormat:=xlCSV _ , CreateBackup:=False Workbooks.Open Filename:= _ "G:\Standards\levels\_std_levels.xls" Workbooks("bmtopo_levels.csv").Close SaveChanges:=False End Sub I suspect that I need some sort of variable in place of "bmtopo", but I can't find any info in the online Help and I don't know the syntax to add that variable to "_levels". TIA, Scott |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I save only active worksheet without save all of worksheet | Excel Worksheet Functions | |||
Save a worksheet by itself to a new file | Excel Discussion (Misc queries) | |||
Save worksheet to seperate file? | Excel Discussion (Misc queries) | |||
Insrt curr file name & name of active worksheet respectively | Excel Worksheet Functions | |||
Save an image from a worksheet to a file | Excel Programming |