Avatar of AlizaN
AlizaN
 asked on

xlbook.WorkSheets(1).SaveAs finalfilename, -4143 "unknown runtime error"

hi, i followed the suggestion in the related post but when I changed my code from:
xlbook.WorkSheets(1).SaveAs(finalfilename)
to
xlbook.WorkSheets(1).SaveAs finalfilename, -4143
 I get "Unknown runtime error".

Any idea what I'm doing wrong?  the first line works, the second doesn't. (I am working asp, vbscript)

thank you.
VB ScriptMicrosoft Excel

Avatar of undefined
Last Comment
Cory Vandenberg

8/22/2022 - Mon
cy_hung

why not use ?
xlbook.WorkSheets(1).SaveAs ( finalfilename, -4143 )
Cory Vandenberg

What version of Excel are you using?  If it's 2003 or prior, then -4143 will save as a .xls file.  If you are using 2007, then you should use one of the new enumerations.  Check out this link for an list of the ones for 07.

http://blogs.msdn.com/excel/archive/2009/07/07/use-the-vba-saveas-method-in-excel-2007.aspx

WC
AlizaN

ASKER
WarCrimes - i'm using 2003
cyhung - xlbook.WorkSheets(1).SaveAs ( finalfilename, -4143 )  will give the error "cannot use parentheses when calling sub"
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Cory Vandenberg

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
AlizaN

ASKER
thanks, that was it!
Cory Vandenberg

Take that back....SaveAs is a method for a worksheet object, but I can't get it to work the way you have it in Excel 03 either.

Are you wanting to save the entire workbook, or just one sheet out of it as a separate document?

If the entire workbook, then use the workbook object as in my last post.