xltm saveas xlsm

H

Helmut

I have the following code within an "xltm" file which I want to then save as
"xlsm":

Do
fName = Application.GetSaveAsFilename(InitialFileName:="kupa",
filefilter:= _
" Excel Macro Enabled Workbook (*.xlsm), *.xlsm,")
Loop Until fName <> False
ActiveWorkbook.SaveAs Filename:=fName

I get ERROR on last statement. How can I add "FileFormatValue = 52" to save
the file as a "MacroEnabled"
thanks
 
B

Bob Phillips

Did you try adding FileFormat:= xlOpenXMLWorkbookMacroEnabled to the save
statement?

HTH

Bob
 
H

Helmut

Bob, YES, I did try that too. It seems no matter what I add, it is ignored
and it gives me error that it cannot save a file with macro in non-macro
extension and saves it without macro and without extension.
Help
 
H

Helmut

Bob,
I get "Run-time error '1004' - Method 'SaveAs' of 'object '_Workbook' failed."
Helmut
 
B

Bob Phillips

This is odd Helmut. I have just tried your code and it works fine for me, I
didn't even need the FileFormat property, so there must be something else in
your code.

HTH

Bob
 
H

Helmut

Bob,
The following did finally work:

' Save File as "xlsm" in new location

Do
fName = Application.GetSaveAsFilename(InitialFileName:=Myvalue,
filefilter:= _
" Excel Macro Enabled Workbook (*.xlsm), *.xlsm,")
Loop Until fName <> False

ActiveWorkbook.SaveAs Filename:=fName,
FileFormat:=xlOpenXMLWorkbookMacroEnabled

Thanks for your help anyhow.
 

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