Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I save only active worksheet without save all of worksheet droth Excel Worksheet Functions 2 February 21st 09 05:11 PM
Save a worksheet by itself to a new file Rich Excel Discussion (Misc queries) 2 December 9th 08 03:01 PM
Save worksheet to seperate file? George Excel Discussion (Misc queries) 4 October 30th 06 08:30 PM
Insrt curr file name & name of active worksheet respectively Olga Cook Excel Worksheet Functions 2 March 7th 06 10:39 PM
Save an image from a worksheet to a file barbral Excel Programming 1 August 15th 03 02:39 PM


All times are GMT +1. The time now is 10:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"