A
Anne Schouten
I made in Excel 2007 a template with many macros.
By default the new workbook is saved as .xlsx (without macros)
I want the default to be .xlsm (with macros), but I want to give the user
the opportunity to save it as 97-2003 workbook aswel.
I made the vba code as shown below.
The FileFilter works fine in the 'Save as' dialog window, but I do not know
how to use the chosen FileFormat.
intFileFormat is not changed by this dialogwindow. So with this code the
file is still saved as .xlsx
Who knows how to solve this problem?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
....
varName = Application.GetSaveAsFilename( _
fileFilter:="Excel werkmap met macro's (*.xlsm),*.xslm,Excel
werkmap (*.xlsx), *.xlsx,Excel 97-2003 (*.xls),*.xls")
If varName <> False Then
Cancel = True
intFileFormat = ActiveWorkbook.FileFormat
ActiveWorkbook.SaveAs Filename:= varName ', FileFormat:=
intFileFormat
End If
End Sub
Thanks, Anne
By default the new workbook is saved as .xlsx (without macros)
I want the default to be .xlsm (with macros), but I want to give the user
the opportunity to save it as 97-2003 workbook aswel.
I made the vba code as shown below.
The FileFilter works fine in the 'Save as' dialog window, but I do not know
how to use the chosen FileFormat.
intFileFormat is not changed by this dialogwindow. So with this code the
file is still saved as .xlsx
Who knows how to solve this problem?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
....
varName = Application.GetSaveAsFilename( _
fileFilter:="Excel werkmap met macro's (*.xlsm),*.xslm,Excel
werkmap (*.xlsx), *.xlsx,Excel 97-2003 (*.xls),*.xls")
If varName <> False Then
Cancel = True
intFileFormat = ActiveWorkbook.FileFormat
ActiveWorkbook.SaveAs Filename:= varName ', FileFormat:=
intFileFormat
End If
End Sub
Thanks, Anne