![]() |
Prompt for SaveAsDialog with file type preset.
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 |
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 |
Prompt for SaveAsDialog with file type preset.
I use this
/code Sub CSVName() FullFileName = Application.GetSaveAsFilename("", "CSV (Comma delimited)(*.csv),*.csv", 1, "Save As *.csv") If FullFileName < "False" Then ActiveWorkbook.SaveAs Filename:=FullFileName, FileFormat:=xlCSV End If End Sub /code Craig "invictus1964" wrote in message ... 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 |
All times are GMT +1. The time now is 09:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com