|
-
Sep 21st, 2006, 01:48 PM
#1
Thread Starter
New Member
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:
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:
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.
-
Sep 21st, 2006, 02:11 PM
#2
Re: Another Excel Save Problem
Try
VB Code:
Dim savePath As String = "C:\TEST\" & Now.ToString("MMddyy") & ".xls"
objExcel.ActiveWorkbook().SaveAs(savePath)
Or if you insist on keeping your code then
VB Code:
objExcel.ActiveWorkbook().SaveAs("C:\TEST\" & (Format(Now.Date, "MMddyy")))
-
Sep 21st, 2006, 04:18 PM
#3
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|