Saving worksheet as .csv type

W

William Maka

I would like the Save As dialog window when it opens to
automatically show worksheet file type as .CSV.

How can I incorporate that in Visual Basic code below:

Application.Dialogs(xlDialogSaveAs).Show "C:\DOC\Sample\"
+ MySheet + ".csv"
 
D

Dan E

William,

I'm not sure how using the dialogs, but here's an alternative

SaveName = Application.GetSaveAsFilename(Initialfilename:="C:\DOC\Sample\" & Mysheet & ".csv", _
FileFilter:="CSV (Comma Delimited) (*.csv), *.csv")
ThisWorkbook.SaveAs Filename:=SaveName, FileFormat:=xlCSV

Dan E
 

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