ActiveWorkbook.SaveAs

G

Guest

I have transfered from Office 2005 to 2007 Excel Macros which have now
stopped working on the "ActiveWorkbook.SaveAs" line. I have started getting
the infamous "Error 1004." The whole line is highligted, which leads me to
believe that the start of the line is the problem. I include the line as in
Macro, with the exception that the "My Documents" on to the underscore would
be on one line:

ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Frank\My
Documents\transfer\ftproot\aartfile.xls", _
FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Any help will be deeply appreciated.
 
J

Jim Rech

Excel 2007 does not support this format: FileFormat:=xlExcel9795. You
should use: xlWorkbookNormal (.xls) or xlWorkbookDefault (.xlsx) or
xlOpenXMLWorkbookMacroEnabled (.xlsm).
--
Jim
|I have transfered from Office 2005 to 2007 Excel Macros which have now
| stopped working on the "ActiveWorkbook.SaveAs" line. I have started
getting
| the infamous "Error 1004." The whole line is highligted, which leads me
to
| believe that the start of the line is the problem. I include the line as
in
| Macro, with the exception that the "My Documents" on to the underscore
would
| be on one line:
|
| ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Frank\My
| Documents\transfer\ftproot\aartfile.xls", _
| FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
| ReadOnlyRecommended:=False, CreateBackup:=False
|
| Any help will be deeply appreciated.
 
S

smedz0713

Excel 2007 does not support this format: FileFormat:=xlExcel9795. You
should use: xlWorkbookNormal (.xls) or xlWorkbookDefault (.xlsx) or
xlOpenXMLWorkbookMacroEnabled (.xlsm).
--

|I have transfered from Office 2005 to 2007 Excel Macros which have now
| stopped working on the "ActiveWorkbook.SaveAs" line. I have started
getting
| the infamous "Error 1004." The whole line is highligted, which leads me
to
| believe that the start of the line is the problem. I include the line as
in
| Macro, with the exception that the "My Documents" on to the underscore
would
| be on one line:
|
| ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Frank\My
| Documents\transfer\ftproot\aartfile.xls", _
| FileFormat:=xlExcel9795, Password:="", WriteResPassword:="", _
| ReadOnlyRecommended:=False, CreateBackup:=False
|
| Any help will be deeply appreciated.

Is there any way to do the equivalent of #ifdef (a preprocessor
directive) in VBA to check to see if xlExcel8 (56) is defined? I
don't like having to hack all the constants if I can set at the top of
my sub or in a public module the check for application version and
define xlExcel8 (if it doesn't already exist) as xlWorkbookNormal.
Then, for backwards compatibility, I only have to use xlExcel8.

Any thoughts would be greatly appreciated.
 
G

Guest

It works on my Macro. I substituted your suggestion (8 instead of 56), into
the line,
".....FileFormat:=xlExcel8, xxxxxx." It at least allows me to keep the code
mostly the same! Thanks!

fs
 

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