Save To Csv Running A Macro

S

stevekirk

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
stev
 
D

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top