Excel 2010 Saveas macro issues

chicosbailbonds

New Member
Joined
Dec 18, 2009
Messages
44
As part of my code I define the path and filename of where I want this file to be saved.

Code:
Dim NEWDAYXLS As String
Dim NEWDAYPATH As String

Code:
NEWDAYXLS = Sheets("Dates").Range("M5")
NEWDAYPATH = Sheets("Dates").Range("O5")

Do work to roll the day of the file

Code:
ActiveWorkbook.SaveAs Filename:=NEWDAYPATH & NEWDAYXLS, FileFormat:=52

This does not seem to work as I am getting a method Saveas of object' _Workbook failed on the last piece of code shown above.

Anyone have any thoughts? Thanks for your time and help in advance.
Jim
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You need to make sure that you have the proper path like "C:\" and the correct backslashes. Check and see what this returns now: NEWDAYPATH & NEWDAYXLS

I'd imagine you just need to add some tweaks, like NEWDAYPATH & "\"& NEWDAYXLS

HTH,
 
Upvote 0
It returns: X:/OPS/Daily Reports/2011/04-2011/Tax Lot Appraisal - 04.12.2011.XLSM

Which I believe is what I want it to return. The only item I am not sure about is if I need the Filename to include the .xlsm or if that is automatic.
 
Upvote 0
What happens if you try to save with the physical path/name as you posted it? And generally you do include the extension.
 
Upvote 0
Thank you for your help, I figured it had to be something dumb on my part and it was. After trying to save it down manually using the info from the immediate window I received an error. After staring at it for a few minutes I realized I was using the wrong slash. Should be "\"!
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,735
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top