View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Macka Macka is offline
external usenet poster
 
Posts: 1
Default 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!