Add a prefix to a file name?

Philip1957

Board Regular
Joined
Sep 30, 2014
Messages
145
Greetings,

I have a macro that creates a new workbook and saves it with the file name composed of a number in cell A09.

Code:
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\TDN Forms\" & Worksheets("Rev #").Range("AO9") & ".xlsx", CreateBackup:=False
How can I insert a prefix to the file name? Currently it saves the file as just a number, 35.xlxs, but I would like it to save the file as TDN-35.xlxs

Thanks in advance for any assistance.

~ Phil
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
16,836
Office Version
2010
Platform
Windows
You could put TDN-35 in cell AO9. If that's not acceptable try:
Rich (BB code):
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\TDN Forms\" & "TDN-" & Worksheets("Rev #").Range("AO9") & ".xlsx", CreateBackup:=False
 

Philip1957

Board Regular
Joined
Sep 30, 2014
Messages
145
Thank you very much!

As is usually the case, I made a newbie error and had the quote marks wrong.

~ Phil
 

Watch MrExcel Video

Forum statistics

Threads
1,099,252
Messages
5,467,557
Members
406,543
Latest member
semoredhawk

This Week's Hot Topics

Top