Creating macro enabled Excel 2007 workbook

  • Thread starter Thread starter Ken Warthen
  • Start date Start date
K

Ken Warthen

I need to create a macro enabled Excel 2007 workbook from a routine in
another workbook. I've tried using the workbook.add method but it does not
support the macro enabled file type or xlsm extension. Any help is always
greatly appreciated.

Ken
 
Your xl version?
xl2007 can work with a regular .xls file
The user can open and, if desired, save as .xlsM
 
This saves an .xlsm file on my desktop

Option Explicit
Sub Test()
Dim myWB As Excel.Workbook
Dim myFolder As String


Set myWB = Workbooks.Add
myFolder = "C:\Documents and Settings\" & _
Environ("USERNAME") & "\Desktop\"
myWB.SaveAs myFolder & "BarbsFile.xlsm", FileFormat:=52


End Sub

In Excel 2007, you need to include the FileFormat. Read this from Ron de
Bruin

http://www.rondebruin.nl/saveas.htm

HTH,
Barb Reinhardt
 
Back
Top