VBA to 'Save As' not working

Mel Smith

Well-known Member
Joined
Dec 13, 2005
Messages
1,023
Office Version
  1. 365
Platform
  1. Windows
I am trying include code to Save As .xlsm but it doesn't save a usable file. It saves the file as intended but not as Excel.xlsm or anything else. In fact the newly saved file cannot be opened...

The code I have used is:

Dim Fname As String
Fname = ActiveWorkbook.Name & Format(Date, "ddmmyy")
ActiveWorkbook.SaveAs "C:\Users\melsm\Documents" & Fname, 52

Is there anything missing from my code or is there another way to achieve what I'm trying to do?

Many thanks.

Mel
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Further to my previous post; I missed out Dim ReportDate As String. I have also realised that the unusable file is being save with a file extension .xlsm050118 whereas what I'm after is the file name (which is MRS Sorting Template to be saved as MRS Sorting Template 050118.xlsm (and tomorrow as ....060118.xlsm).

Mel
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

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