Code Check

Katy Jordan

Well-known Member
Joined
Jun 28, 2008
Messages
596
Hi, i have the following line of code saves file to the current path, i would like to save this to another location H:\Recs\Rec_Stats also i would like the file to save as month before so it should read Rec_Stats Feb-09

<TABLE style="WIDTH: 364pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=485 border=0><COLGROUP><COL style="WIDTH: 364pt; mso-width-source: userset; mso-width-alt: 17737" width=485><TBODY><TR style="HEIGHT: 16.5pt" height=22><TD class=xl66 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; WIDTH: 364pt; BORDER-BOTTOM: #f0f0f0; HEIGHT: 16.5pt; BACKGROUND-COLOR: transparent" width=485 height=22>SaveCopyAs ThisWorkbook.Path & "\Rec_Stats " & Format(Date,"mmmm-yy") & ".xls"


</TD></TR></TBODY></TABLE>
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

bk

Active Member
Joined
Jun 2, 2002
Messages
387
Assuming what you posted works, I've never done it that way, but this should take care of your Q:

ActiveWorkbook.SaveAs ("H:\Recs\Rec_Stats\Rec_Stats Feb-09.xls")
 
Upvote 0

Katy Jordan

Well-known Member
Joined
Jun 28, 2008
Messages
596
Assuming what you posted works, I've never done it that way, but this should take care of your Q:

ActiveWorkbook.SaveAs ("H:\Recs\Rec_Stats\Rec_Stats Feb-09.xls")

i need the date part to be generic, i dont want to write Feb in the code, i would like the code to work that out
 
Upvote 0

bk

Active Member
Joined
Jun 2, 2002
Messages
387
Oh, your accent must've thrown me when reading :)

Well, you can place a variable inside the code I gave; so, something like.....

...I know this works in 3 steps, probably 1 with the effort, but will be safe.

myDate = Format(Date, "mmmm-yy")
myFileName = "H:\Recs\Rec_Stats\Rec_Stats " & myDate & ".xls"
ActiveWorkbook.SaveAs (myFileName)

How's that?
 
Upvote 0

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
I did something similiar like this

Code:
cdte = WorksheetFunction.Text(Range("a1"), "mmmm-yy")

Workbooks.Open Filename:= _
"C:\MY DOCUMENTS\Unbilled and BIE\" & cdte & ".xls"
 
Upvote 0

Katy Jordan

Well-known Member
Joined
Jun 28, 2008
Messages
596
Oh, your accent must've thrown me when reading :)

Well, you can place a variable inside the code I gave; so, something like.....

...I know this works in 3 steps, probably 1 with the effort, but will be safe.

myDate = Format(Date, "mmmm-yy")
myFileName = "H:\Recs\Rec_Stats\Rec_Stats " & myDate & ".xls"
ActiveWorkbook.SaveAs (myFileName)

How's that?

Excellent, that works, thanks BK
 
Upvote 0

Forum statistics

Threads
1,191,671
Messages
5,987,957
Members
440,121
Latest member
eravella

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
Top