View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Prompt for SaveAsDialog with file type preset.

maybe...

dim myFileName as Variant
myfilename = application.getsaveasfilename("comma separated values, *.csv")
if myfilename = false then
'user hit cancel
else
activeworkbook.saveas filename:=myfilename, fileformat:=xlCSV
end if

..getsaveasfilename won't do the save, but it'll give you the name--so you can do
your own save.

invictus1964 wrote:

I want to prompt the user for a save as file name and defualt the file type
to csv. I am trying
Application.Dialogs(xlDialogSaveAs).Show Arg2:=xlCSV
result: saves file as csv then code is interrupted
also tried
Filename = Application.GetSaveAsFilename( _
fileFilter:="Comma Seperated Values (*.csv), *.csv")
result: no interruption but does not save file and cannot recall name using
ActiveWorkbook.SaveAs


--

Dave Peterson