ftm
01-28-2010, 02:14 AM
I have a need to prompt the user to save their document as soon as it opens. They are provided with a default path but they should type in the filename and click the Save button on the msoFileDialogSaveAs dialog box. My original code is below:
With Application.FileDialog(msoFileDialogSaveAs)
.InitialFileName = "\\Servername\Foldername\"
.Execute
End With
This works OK but the problem is that because the Word document contains a macro it will not allow the user to save the file as the default .docx file type. The workaround is that the user can change the file type in the dropdownlist on the msoFileDialogSaveAs box. However I would much prefer to automate this for them so that the dialog box shows the .docm file type as default.
I have tried to control the filters available to the user but I cannot seem to get the code below to work. The error message when running reports that the method/property is unsupported. However the code compiles and Intellisense offers me the methods I want to use for the msoFileDialogSaveAs object.
With Application.FileDialog(msoFileDialogSaveAs)
.InitialFileName = "\\Servername\Foldername\"
.Title = "Please choose the location to save your experiment write-up"
.Filters.Clear
.Filters.Add "Word Macro-Enabled Document (*.docm)", "*.docm"
.FilterIndex = 0
.Execute
End With
If anybody can help I would be grateful. I just want to offer the msoFileDialogSaveAs dialog box to the user with the .docm file type as default.
With Application.FileDialog(msoFileDialogSaveAs)
.InitialFileName = "\\Servername\Foldername\"
.Execute
End With
This works OK but the problem is that because the Word document contains a macro it will not allow the user to save the file as the default .docx file type. The workaround is that the user can change the file type in the dropdownlist on the msoFileDialogSaveAs box. However I would much prefer to automate this for them so that the dialog box shows the .docm file type as default.
I have tried to control the filters available to the user but I cannot seem to get the code below to work. The error message when running reports that the method/property is unsupported. However the code compiles and Intellisense offers me the methods I want to use for the msoFileDialogSaveAs object.
With Application.FileDialog(msoFileDialogSaveAs)
.InitialFileName = "\\Servername\Foldername\"
.Title = "Please choose the location to save your experiment write-up"
.Filters.Clear
.Filters.Add "Word Macro-Enabled Document (*.docm)", "*.docm"
.FilterIndex = 0
.Execute
End With
If anybody can help I would be grateful. I just want to offer the msoFileDialogSaveAs dialog box to the user with the .docm file type as default.