ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlDialogs(xlDialogSaveAs) (https://www.excelbanter.com/excel-programming/318407-xldialogs-xldialogsaveas.html)

DanM

xlDialogs(xlDialogSaveAs)
 
I want to suggest a name for the file being saved and test for a return. I
can't seem to do both.
This opens the dialog box and displays my suggested name:
Application.Dialogs(xlDialogSaveAs).Show strSaveAsName
[strSaveAsName contains the suggested name which changes each time the macro
runs]

This allows me to capture the return value from the dialog box:
rtrnVal = Application.Dialogs(xlDialogSaveAs).Show

This gives an error message from the compilier saying that it's looking for
the end of the statement and highlights the variable:
rtrnVal = Application.Dialogs(xlDialogSaveAs).Show strSaveAsName

Please tell me what I'm missing. Thank you very much for your help.
--
Dan Mullen

Ron de Bruin

xlDialogs(xlDialogSaveAs)
 
Try this

rtrnVal = Application.GetSaveAsFilename(strSaveAsName , _
fileFilter:="Excel Files (*.xls), *.xls")


--
Regards Ron de Bruin
http://www.rondebruin.nl


"DanM" wrote in message ...
I want to suggest a name for the file being saved and test for a return. I
can't seem to do both.
This opens the dialog box and displays my suggested name:
Application.Dialogs(xlDialogSaveAs).Show strSaveAsName
[strSaveAsName contains the suggested name which changes each time the macro
runs]

This allows me to capture the return value from the dialog box:
rtrnVal = Application.Dialogs(xlDialogSaveAs).Show

This gives an error message from the compilier saying that it's looking for
the end of the statement and highlights the variable:
rtrnVal = Application.Dialogs(xlDialogSaveAs).Show strSaveAsName

Please tell me what I'm missing. Thank you very much for your help.
--
Dan Mullen





All times are GMT +1. The time now is 01:37 AM.

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