LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Save as, changing default fileformat in Excel 2007

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save as default Excel 2007 nancyt Excel Discussion (Misc queries) 4 September 11th 09 09:55 PM
changing default highlight color in Excel 2007 Ana Setting up and Configuration of Excel 1 June 19th 09 02:49 AM
changing default search location in Excel 2007 Find. David Pedersen Excel Discussion (Misc queries) 3 September 4th 08 04:32 PM
Excel 2007 Save As xlsm by default Zarch Excel Programming 1 October 29th 07 03:46 PM
Default Excel FileFormat? Kou Vang[_2_] Excel Programming 2 January 26th 06 03:25 PM


All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"