ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs XLSM question (https://www.excelbanter.com/excel-programming/417986-saveas-xlsm-question.html)

Barb Reinhardt

SaveAs XLSM question
 
I'm trying to save a workbook as a .xlsm in Excel 2007 using code.

I find that this works

ThisWorkbook.SaveAs Filename:=filesavename, _
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled


And this doesn't

ThisWorkbook.SaveAs Filename:=filesavename

The workbook can be saved, but it can never be opened again.

Why?

Barb Reinhardt


Bernard Liengme

SaveAs XLSM question
 
Because it has a macro! That is why MS gave us the XLSM extension, so we
know the file has a macro and we can proceed accordingly.

Try doing a manual save (Office | Save) with a macro containing file. See
what happens when you try to save as XLSX
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in message
...
I'm trying to save a workbook as a .xlsm in Excel 2007 using code.

I find that this works

ThisWorkbook.SaveAs Filename:=filesavename, _
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled


And this doesn't

ThisWorkbook.SaveAs Filename:=filesavename

The workbook can be saved, but it can never be opened again.

Why?

Barb Reinhardt




Barb Reinhardt

SaveAs XLSM question
 
Hi Bernard,

I would have thought that if I was saving it as a .xlsm it would know that I
wanted to save it as a macro enabled workbook. I need to tell it the file
name (with the extension) and also make sure it includes the correct
FileFormat. I'd call that overkill, but then I'm not Microsoft. Should I
have been including theFileFormat all along for .xls workbooks?

Also, I'm running this code in both 2003 and 2007. I changed
xlOpenXMLWorkbookMacroEnabled to 52 (I think) and it worked in 2003 and 2007.
Is there any reason I shouldn't do this?

Thanks,
Barb Reinhardt

"Bernard Liengme" wrote:

Because it has a macro! That is why MS gave us the XLSM extension, so we
know the file has a macro and we can proceed accordingly.

Try doing a manual save (Office | Save) with a macro containing file. See
what happens when you try to save as XLSX
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in message
...
I'm trying to save a workbook as a .xlsm in Excel 2007 using code.

I find that this works

ThisWorkbook.SaveAs Filename:=filesavename, _
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled


And this doesn't

ThisWorkbook.SaveAs Filename:=filesavename

The workbook can be saved, but it can never be opened again.

Why?

Barb Reinhardt





Bernard Liengme

SaveAs XLSM question
 
I will let someone else comment on xlOpenXMLWorkbookMacroEnabled set to 52
since I have never done this

I would trap the Excel version and issue the appropriate Save command
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in message
...
Hi Bernard,

I would have thought that if I was saving it as a .xlsm it would know that
I
wanted to save it as a macro enabled workbook. I need to tell it the
file
name (with the extension) and also make sure it includes the correct
FileFormat. I'd call that overkill, but then I'm not Microsoft. Should
I
have been including theFileFormat all along for .xls workbooks?

Also, I'm running this code in both 2003 and 2007. I changed
xlOpenXMLWorkbookMacroEnabled to 52 (I think) and it worked in 2003 and
2007.
Is there any reason I shouldn't do this?

Thanks,
Barb Reinhardt

"Bernard Liengme" wrote:

Because it has a macro! That is why MS gave us the XLSM extension, so we
know the file has a macro and we can proceed accordingly.

Try doing a manual save (Office | Save) with a macro containing file. See
what happens when you try to save as XLSX
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in
message
...
I'm trying to save a workbook as a .xlsm in Excel 2007 using code.

I find that this works

ThisWorkbook.SaveAs Filename:=filesavename, _
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled


And this doesn't

ThisWorkbook.SaveAs Filename:=filesavename

The workbook can be saved, but it can never be opened again.

Why?

Barb Reinhardt







Barb Reinhardt

SaveAs XLSM question
 
I tried that and in Excel 2003, it didn't like the
xlOpenXLMWOrkbookMacroEnabled, but it did like having it set to 52 (or
whatever it was). Thanks for your assistance

Barb Reinhardt

"Bernard Liengme" wrote:

I will let someone else comment on xlOpenXMLWorkbookMacroEnabled set to 52
since I have never done this

I would trap the Excel version and issue the appropriate Save command
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in message
...
Hi Bernard,

I would have thought that if I was saving it as a .xlsm it would know that
I
wanted to save it as a macro enabled workbook. I need to tell it the
file
name (with the extension) and also make sure it includes the correct
FileFormat. I'd call that overkill, but then I'm not Microsoft. Should
I
have been including theFileFormat all along for .xls workbooks?

Also, I'm running this code in both 2003 and 2007. I changed
xlOpenXMLWorkbookMacroEnabled to 52 (I think) and it worked in 2003 and
2007.
Is there any reason I shouldn't do this?

Thanks,
Barb Reinhardt

"Bernard Liengme" wrote:

Because it has a macro! That is why MS gave us the XLSM extension, so we
know the file has a macro and we can proceed accordingly.

Try doing a manual save (Office | Save) with a macro containing file. See
what happens when you try to save as XLSX
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in
message
...
I'm trying to save a workbook as a .xlsm in Excel 2007 using code.

I find that this works

ThisWorkbook.SaveAs Filename:=filesavename, _
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled


And this doesn't

ThisWorkbook.SaveAs Filename:=filesavename

The workbook can be saved, but it can never be opened again.

Why?

Barb Reinhardt








Ron de Bruin

SaveAs XLSM question
 
Hi Barb

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

Use the number and you have no problem if you compile your project in whatever Excel version


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Barb Reinhardt" wrote in message
...
I tried that and in Excel 2003, it didn't like the
xlOpenXLMWOrkbookMacroEnabled, but it did like having it set to 52 (or
whatever it was). Thanks for your assistance

Barb Reinhardt

"Bernard Liengme" wrote:

I will let someone else comment on xlOpenXMLWorkbookMacroEnabled set to 52
since I have never done this

I would trap the Excel version and issue the appropriate Save command
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in message
...
Hi Bernard,

I would have thought that if I was saving it as a .xlsm it would know that
I
wanted to save it as a macro enabled workbook. I need to tell it the
file
name (with the extension) and also make sure it includes the correct
FileFormat. I'd call that overkill, but then I'm not Microsoft. Should
I
have been including theFileFormat all along for .xls workbooks?

Also, I'm running this code in both 2003 and 2007. I changed
xlOpenXMLWorkbookMacroEnabled to 52 (I think) and it worked in 2003 and
2007.
Is there any reason I shouldn't do this?

Thanks,
Barb Reinhardt

"Bernard Liengme" wrote:

Because it has a macro! That is why MS gave us the XLSM extension, so we
know the file has a macro and we can proceed accordingly.

Try doing a manual save (Office | Save) with a macro containing file. See
what happens when you try to save as XLSX
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in
message
...
I'm trying to save a workbook as a .xlsm in Excel 2007 using code.

I find that this works

ThisWorkbook.SaveAs Filename:=filesavename, _
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled


And this doesn't

ThisWorkbook.SaveAs Filename:=filesavename

The workbook can be saved, but it can never be opened again.

Why?

Barb Reinhardt









Barb Reinhardt

SaveAs XLSM question
 
Thanks Ron. That did it!

Barb

"Ron de Bruin" wrote:

Hi Barb

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

Use the number and you have no problem if you compile your project in whatever Excel version


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Barb Reinhardt" wrote in message
...
I tried that and in Excel 2003, it didn't like the
xlOpenXLMWOrkbookMacroEnabled, but it did like having it set to 52 (or
whatever it was). Thanks for your assistance

Barb Reinhardt

"Bernard Liengme" wrote:

I will let someone else comment on xlOpenXMLWorkbookMacroEnabled set to 52
since I have never done this

I would trap the Excel version and issue the appropriate Save command
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in message
...
Hi Bernard,

I would have thought that if I was saving it as a .xlsm it would know that
I
wanted to save it as a macro enabled workbook. I need to tell it the
file
name (with the extension) and also make sure it includes the correct
FileFormat. I'd call that overkill, but then I'm not Microsoft. Should
I
have been including theFileFormat all along for .xls workbooks?

Also, I'm running this code in both 2003 and 2007. I changed
xlOpenXMLWorkbookMacroEnabled to 52 (I think) and it worked in 2003 and
2007.
Is there any reason I shouldn't do this?

Thanks,
Barb Reinhardt

"Bernard Liengme" wrote:

Because it has a macro! That is why MS gave us the XLSM extension, so we
know the file has a macro and we can proceed accordingly.

Try doing a manual save (Office | Save) with a macro containing file. See
what happens when you try to save as XLSX
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Barb Reinhardt" wrote in
message
...
I'm trying to save a workbook as a .xlsm in Excel 2007 using code.

I find that this works

ThisWorkbook.SaveAs Filename:=filesavename, _
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled


And this doesn't

ThisWorkbook.SaveAs Filename:=filesavename

The workbook can be saved, but it can never be opened again.

Why?

Barb Reinhardt











All times are GMT +1. The time now is 12:42 AM.

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