Excel Macro VBA to Append to existing file name


Looking for some Excel VBA, to pre-pend to an existing filename.  The spreadsheet comes to me with the a file name in number format  like

the file name changes daily,

so after I make my changes , i want to have excel VBA macro that prepends to the existing file name, "MAC_(then the old filename.xls)
Who is Participating?
The simplest version - no test for pre-existing file of same name...

Sub PrePendToFilename()
ActiveWorkbook.SaveAs (Replace(ActiveWorkbook.FullName, ActiveWorkbook.Name, "Mac_" & ActiveWorkbook.Name))
End Sub

the simply searches for the name of the replaces the name of the existing workbook within its full path with the new name and saves the file in the same folder as the original but with the new name.
rsernowskiAuthor Commented:
Hi Simon
Excellent , Thanks for your help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.