ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msoFileDialogSaveAs problem (https://www.excelbanter.com/excel-programming/333286-msofiledialogsaveas-problem.html)

Macka

msoFileDialogSaveAs problem
 
I can't get the Execut method to work.
I have this code:

Sub SaveAsDialog()
'Other workbook then this should be active
Dim fd As FileDialog
On Error GoTo OnError
Set fd = Application.FileDialog(msoFileDialogSaveAs)
With fd
.AllowMultiSelect = False
.InitialFileName = ActiveWorkbook.Name
If .Show = -1 Then
.Execute
End If
End With
Exit Sub
OnError:
Debug.Print "Errnumber: " & Err.Number & " " & "ErrDesc: " &
Err.Description
End Sub
'I get this:
'Errnumber: -2147467259 ErrDesc: Method 'Execute' of object 'FileDialog'
failed

Eaven if I just save as C:\MyFile.xls the error ocurres,
so the problem is not write protection or similar error.

Please Help!



All times are GMT +1. The time now is 11:28 AM.

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