ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating macro enabled Excel 2007 workbook (https://www.excelbanter.com/excel-programming/433845-creating-macro-enabled-excel-2007-workbook.html)

Ken Warthen[_2_]

Creating macro enabled Excel 2007 workbook
 
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

Don Guillett

Creating macro enabled Excel 2007 workbook
 

Your xl version?
xl2007 can work with a regular .xls file
The user can open and, if desired, save as .xlsM
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ken Warthen" wrote in message
...
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



Barb Reinhardt

Creating macro enabled Excel 2007 workbook
 
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

"Ken Warthen" wrote:

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



All times are GMT +1. The time now is 07:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com