Results 1 to 3 of 3

Thread: Another Excel Save Problem [RESOLVED]

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Another Excel Save Problem [RESOLVED]

    Hello Everyone!

    I posted a topic yesterday regarding saving a file in Excel to today's current date which stanav helped me out with (Thanks Again Stan!) however I did have one little problem.

    When I have the application save the data using the following code:

    VB Code:
    1. objExcel.ActiveWorkbook().SaveAs(Format(Now.Date, "MMddyy"))

    It automatically gets saved to the My Documents folder on the machine. How would I go about saving this file in this date fashion shown above but also save it to a directory in particular....lets just say save it to C:\TEST...

    I tried saving the file using this code:

    VB Code:
    1. objExcel.ActiveWorkbook().SaveAs("C:\TEST"(Format(Now.Date, "MMddyy")))

    But would get the follwoing error after I ran the program
    Index was outside the bounds of the array.

    Thanks!!
    Last edited by wakka; Sep 21st, 2006 at 04:18 PM.

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Another Excel Save Problem

    Try
    VB Code:
    1. Dim savePath As String = "C:\TEST\" & Now.ToString("MMddyy") & ".xls"
    2. objExcel.ActiveWorkbook().SaveAs(savePath)
    Or if you insist on keeping your code then
    VB Code:
    1. objExcel.ActiveWorkbook().SaveAs("C:\TEST\" & (Format(Now.Date, "MMddyy")))

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Re: Another Excel Save Problem

    WOW and just to think all I was missing was an "&"..LOL....STANAV YOU ARE THE MAN!!! Thanks Again!!

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