PDA

Click to See Complete Forum and Search --> : SaveAs


Cmathis
Jun 21st, 2001, 12:03 PM
Via vbscript, I am creating an Excel Worksheet and I want to be able to save the file when it is finished...This is my current code for doing do:

xlsheet.saveas "r:\Reports\" & DBase & ".xls"

This command works fine in a VB environment, but with VbScript, it generates an error...Does anyone know how I can save the xls file when I am finished editing it through script?

Thanks for any help!

JoshT
Jun 21st, 2001, 01:16 PM
What exactly is the Dbase refering to?

You may have to change it to:

xlsheet.saveas "r:\Reports\" & Cstr(DBase) & ".xls"

Cmathis
Jun 21st, 2001, 01:26 PM
Dbase is just a refering to a string...I tried adding the "Cstr()" but it still doesn't work...The error given says "Object Required: saveas"

JoshT
Jun 21st, 2001, 01:58 PM
The methods of the Excel.Worksheet object should be the same in VBscript as they are in VB. I think the problem is with the xlsheet object earlier in your script. Would you mind showing a little more code?

Cmathis
Jun 21st, 2001, 02:27 PM
Let me revise what I was asking...I just found out that you can't save a file through VbScript, so now I am wandering if I will be able to print the Excel sheet through script?