Jim Rech
12/19/2006 9:45:00 PM
FYI, if your goal is to assist the user in saving the workbook I think most
developers use Application.GetSaveAsFilename. This gives you more control
as you can set a default name, check/modify the name and folder the user
selects, etc.
Sub SaveFile()
Dim FName As Variant
FName = Application.GetSaveAsFilename(, "Excel files (*.xls),*.xls")
If FName = False Then
MsgBox "User cancelled"
Else
ActiveWorkbook.SaveAs FName
End If
End Sub
--
Jim
"DKS" <DKS@discussions.microsoft.com> wrote in message
news:A61431D6-CF39-49C1-8570-E45520D4869A@microsoft.com...
|I have two questions on the usage of msoFileDialogSaveAs:
|
| (a) in the following code
| With Application.FileDialog(msoFileDialogSaveAs)
| .Show
| .Execute
| End With
|
| when the .execute method is run, a dialog box is saved where one can
browse
| to a folder and save the file. Nevertheless, the dialog box provides a
| CANCEL option also. How do I trap programatically if the user clicks on
| CANCEL button?
|
| (b) second question
|
| My .xls with a macro using the msoFileDialogSaveAs gives an error when run
| from the PC of my friends and colleagues. The error is on the .execute
| method where excel gives an error that the method cannot be applied (or
does
| not exist - I forgot the actual error message but can find out if somebody
| out there needs to know the exact error message).
|
| Any idea why this method works on my PC and not on other's PC with exactly
| same configuration (XP, Excel 2003). I thought that this could have to do
| something with Add-ins. I removed all add-ins from my PC (by simply
| deselecting add-ins via TOOLS, ADD-IN ...). After deselecting all add-ins
I
| re-ran the macro on my PC and it works fine. Thus it cannot be add-in (or
so
| I believe).
|
| All help appreciated.