dmhzx
10-09-2017, 05:40 AM
I'm going round in circles here.
I have this code:
Set fdia = Application.FileDialog(msoFileDialogSaveAs)
With fdia
.AllowMultiSelect = False
.Title = "Select file name to save"
.InitialFileName = SavePath '(which ends with xlsm)
If .Show = False Then
MSG = "You've Cancelled the Save Operation. Entire Process will now be undone"
MsgBox MSG, vbCritical, "Save operation cancelled by user"
GoTo CleanExit:
End If
SavePath = .SelectedItems(1) 'Filedialog has changed both the extension and file type to xlsx
End With
wbDest.SaveAs SavePath, xlOpenXMLWorkbookMacroEnabled '(which errors -- see below)
Savepath going into the filedialog INCLUDES xlsm as the extension.
When the dialog opens WITH the initial filename it has xlsx as the extension. Automatically changed by MS .
I can't find anywhere at all how to set the extension (that is the proper file name) in the FileDialog.
As you might expect, I get an error when I try to save, because the xlsx workbook had code in it.
If I use GetSaveAsFileName, the IntitialFileName is compleltely ignored, and only the 'folder' part navigated to.
So far the only method I've found to get me a xlsm is to change the filename returned from the FileDialog
Is this a known bug: an unknown bug, another output from the MS irritants team or me missing something?
Looking at all the examples on the web, what I've coded SHOULD work, but it doesn't. - And I'm pretty certain used to work in 2007 and 2010.
I have this code:
Set fdia = Application.FileDialog(msoFileDialogSaveAs)
With fdia
.AllowMultiSelect = False
.Title = "Select file name to save"
.InitialFileName = SavePath '(which ends with xlsm)
If .Show = False Then
MSG = "You've Cancelled the Save Operation. Entire Process will now be undone"
MsgBox MSG, vbCritical, "Save operation cancelled by user"
GoTo CleanExit:
End If
SavePath = .SelectedItems(1) 'Filedialog has changed both the extension and file type to xlsx
End With
wbDest.SaveAs SavePath, xlOpenXMLWorkbookMacroEnabled '(which errors -- see below)
Savepath going into the filedialog INCLUDES xlsm as the extension.
When the dialog opens WITH the initial filename it has xlsx as the extension. Automatically changed by MS .
I can't find anywhere at all how to set the extension (that is the proper file name) in the FileDialog.
As you might expect, I get an error when I try to save, because the xlsx workbook had code in it.
If I use GetSaveAsFileName, the IntitialFileName is compleltely ignored, and only the 'folder' part navigated to.
So far the only method I've found to get me a xlsm is to change the filename returned from the FileDialog
Is this a known bug: an unknown bug, another output from the MS irritants team or me missing something?
Looking at all the examples on the web, what I've coded SHOULD work, but it doesn't. - And I'm pretty certain used to work in 2007 and 2010.