Creating macro enabled Excel 2007 workbook

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
 
D

Don Guillett

Your xl version?
xl2007 can work with a regular .xls file
The user can open and, if desired, save as .xlsM
 
B

Barb Reinhardt

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top