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!!
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")))
Re: Another Excel Save Problem
WOW and just to think all I was missing was an "&"..LOL....STANAV YOU ARE THE MAN!!! Thanks Again!!