ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Save To Csv Running A Macro (https://www.excelbanter.com/excel-discussion-misc-queries/104448-save-csv-running-macro.html)

stevekirk

Save To Csv Running A Macro
 

how do i save this macro to a csv file

Sheets("sheet1").Select
Range("E4").Select
Name = ActiveCell.Value
If ActiveCell = "" Then
GoTo 2

Else
ChDir "C:\Documents and Settings\skirk\My Documents\macros"
ActiveWorkbook.SaveAs Filename:=Name

thanks
steve


--
stevekirk
------------------------------------------------------------------------
stevekirk's Profile: http://www.excelforum.com/member.php...o&userid=37328
View this thread: http://www.excelforum.com/showthread...hreadid=570639


Dave Peterson

Save To Csv Running A Macro
 
Maybe...

dim myFileName as string
with worksheets("Sheet1")
.select
myfilename = "C:\Documents and Settings\skirk\My Documents\macros\" & _
.range("E4").value
.parent.saveas filename:=myfilename, fileformat:=xlcsv
end with

But this saves the workbook as a .csv file--it doesn't save the macro in that
..csv file. CSV files are plain text--they don't save formatting, formulas,
macros, etc.


stevekirk wrote:

how do i save this macro to a csv file

Sheets("sheet1").Select
Range("E4").Select
Name = ActiveCell.Value
If ActiveCell = "" Then
GoTo 2

Else
ChDir "C:\Documents and Settings\skirk\My Documents\macros"
ActiveWorkbook.SaveAs Filename:=Name

thanks
steve

--
stevekirk
------------------------------------------------------------------------
stevekirk's Profile: http://www.excelforum.com/member.php...o&userid=37328
View this thread: http://www.excelforum.com/showthread...hreadid=570639


--

Dave Peterson

stevekirk

Save To Csv Running A Macro
 

thanks macro worked great

thank you


--
stevekirk
------------------------------------------------------------------------
stevekirk's Profile: http://www.excelforum.com/member.php...o&userid=37328
View this thread: http://www.excelforum.com/showthread...hreadid=570639



All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com