Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saveas VBA question | Excel Discussion (Misc queries) | |||
SaveAs no question... | Excel Programming | |||
SaveAs Question | Excel Programming | |||
Another SaveAs Question | Excel Programming | |||
SaveAs Question | Excel Programming |