View Single Post
 
Old 01-07-2023, 04:56 AM
Franci Franci is offline Windows 10 Office 2016
Novice
 
Join Date: May 2016
Posts: 12
Franci is on a distinguished road
Default Can't save file using a msoFileDialogSaveAs

Hi!


I have a macro, that should show a file save as dialog and save the file:


Code:
Sub ShowSaveAsDialog()
 Dim dlgSaveAs As FileDialog
 
 Application.FileDialog(msoFileDialogSaveAs).InitialFileName = FName
 
 Set dlgSaveAs = Application.FileDialog( _
 FileDialogType:=msoFileDialogSaveAs)
 dlgSaveAs.Show
 End Sub
I call this macro when the document is closed. When I call it, the dialog shows up (see clipboard1.jpg - sorry, but it's in my native language) and I can select the folder and change the file name, but when I klick on the Save button, the dialog closes and the file isn't saved. Then "Save your changes to this file" dialog opens asking if I would like to save the file (clipboard2.jpg).
In this second dialog the initial file name is not the same as in the first dialog, and also the location for saving not as required.

Can someone please explain why the macro isn't working?
Attached Images
File Type: jpg Clipboard1.jpg (57.0 KB, 11 views)
File Type: jpg Clipboard2.jpg (29.4 KB, 11 views)

Last edited by Franci; 01-07-2023 at 05:20 AM. Reason: adding links to pictures
Reply With Quote