Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default 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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saveas VBA question Lost Excel Discussion (Misc queries) 1 June 2nd 09 07:51 AM
SaveAs no question... okrob Excel Programming 4 January 23rd 07 01:01 AM
SaveAs Question Rob Excel Programming 2 September 10th 06 09:15 PM
Another SaveAs Question chipshot[_2_] Excel Programming 7 April 7th 06 06:58 PM
SaveAs Question Greg Little Excel Programming 3 December 7th 04 02:37 AM


All times are GMT +1. The time now is 09:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"