VBA - Save with new filename

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a macro which runs lots of changes on an excel file, the one thing i
am unsure on how to do is to get the end of the macro to save the file with
an altered name in the same location as the original file, then close the
workbook.

e.g.

The file is named "Test File 2.xls", and I want it to be called "Test File 2
- altered.xls", to be saved in the same location as the original file, then
for the workbook to close.

Any suggestions?

Thanks,
 
Hi

You could use SaveCopyAs

Dim StrPath As String
Dim StrName As String

StrPath = "C:\Place\You\Want\To\Save"
StrName = "Test File 2 - Altered.xls"
ActiveWorkbook.SaveCopyAs StrPath & "\" & StrName
MsgBox "Save Complete", vbOKOnly, "Back UPs"

Hope this helps

S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top