Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 217
Default VBA - Save with new filename

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,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default VBA - Save with new filename

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


Louise wrote:
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,


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
VBA - Save with New Filename Louise Excel Programming 2 October 13th 06 01:59 PM
save as different filename Tom Excel Programming 3 May 4th 05 03:41 AM
Save Filename Peter Excel Programming 3 February 4th 05 01:15 PM
save as filename Geo Siggy[_14_] Excel Programming 3 April 6th 04 01:26 PM


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"