View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Anne Schouten Anne Schouten is offline
external usenet poster
 
Posts: 15
Default Excel 2007 Save as .xlsm

In Excel 2007 I made a template with macros.

If you make a workbook from this template it will, by default, be saved as
workbook without macros (.xlsx)

I would like that the default fileformat will be .xlsm.

I made the following macro to filter the fileformats.

The problem is however that after running this macro the default Save as
dialog box is shown again (the second time without the filter).

How can I prevent that the Save as dialog box is shown twice?





Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Dim varFileName

If ActiveWorkbook.Path = "" Then

varFileName = Application.GetSaveAsFilename( _

fileFilter:="Excel workbook with macros
(*.xlsm),*.xslm,Excel workbook (*.xlsx), *.xlsx, Excel 97-2003
(*.xls),*.xls")

ActiveWorkbook.SaveAs Filename:= varFileName

End If

End Sub





Thank you, Anne