Results 1 to 5 of 5

Thread: SaveAs

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 1999
    Posts
    49

    SaveAs

    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!

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    What exactly is the Dbase refering to?

    You may have to change it to:
    VB Code:
    1. xlsheet.saveas "r:\Reports\" & Cstr(DBase) & ".xls"
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 1999
    Posts
    49
    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"

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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?
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 1999
    Posts
    49
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width