VBA Code to save workbook as "filename" and current date

chrissmarlow

Board Regular
Joined
Jun 3, 2010
Messages
59
Hi guys,

I am looking for code to add to the end of my macro which will save the file as "SRS Sheet - " and then the current date. I want it to save in a folder within the path the current workbook is located, ie. T:\Macrosheet is where the file is now, I want it to save to T:\Macrosheet\Reports

Can anyone help me out with this?
 
Can you please do this for me before the SaveAs line:

debug.print NewPath

Then go to the debug window (ctrl-G) and copy what is in there then paste it in a reply on here for me.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Or just use Vog's code slightly modified:

Code:
ActiveWorkbook.SaveAs ActiveWorkbook.Path & "\SRS Sheet - " & Format(Date, "dd-mm-yyyy") & ".xlsm",52
 
Upvote 0
Extremely sorry for the mistake.. When I use above codlings it was automatically saved self.

Now all good.

Thx Blade for great support

Private Sub CommandButton3_Click()
NewPath = Mid(ThisWorkbook.FullName, 1, _
Len(ThisWorkbook.FullName) - Len(ThisWorkbook.Name)) & "\" & "Dunnings Report - " & Format(Date, "dd-mm-yyyy") & ".xlsm"
ThisWorkbook.SaveAs (NewPath)
End Sub
 
Upvote 0
Old thread, I know. But I'm new here.

I need a code that would save to a full path (very different from where the workbook may be saved). I have VBA that sends e-mails as body and attachment, but I need to save the workbook prior to sending the e-mail.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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