Troubleshooting macro to save in Compatability Mode

P

Pierre

Have the following code to save the active sheet into a new
workbook.
How can I specify that it is to be saved in the 97-2003 compatibility
mode, and in a macro free workbook?

Sub Test()
'
' Test Macro
'
ActiveSheet.Copy
Set newbk = ActiveWorkbook
newbk.ActiveSheet.Cells.Copy
newbk.ActiveSheet.Cells.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

InitialName = ("Monthly_Inventory") & ".xls"
FName = Application.GetSaveAsFilename(InitialFileName:=InitialName, _
fileFilter:="Excel Files (*.xls), *.xls")
newbk.SaveAs Filename:=FName

'
End Sub

Thanks for your thoughts.
Pierre
 
P

Pierre

I figured it out. If it was generated in compatibility mode, it will
save as the same.
If the macro that created it is located on another worksheet in the
original file, the sheet thats copied and saved in the new workbook
will not contain any macros.

Thanks for any effort expended.
Pierre
 
A

AM

I figured it out. If it was generated in compatibility mode, it will
save as the same.
If the macro that created it is located on another worksheet in the
original file, the sheet thats copied and saved in the new workbook
will not contain any macros.

Thanks for any effort expended.
Pierre

Note that once you save a 2k7 file in 2k3 compatibility mode, you MUST
close, then re-open the file to have it be in effect. Otherwise, you
will get cut and paste errors, etc.
 

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