Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding SaveAs functionality 2

Status
Not open for further replies.

mveera

Programmer
Nov 6, 2002
81
US
Hi,

I need to create a copy of the current excel with the filename provided by the user.

I get the filename using the "Application.GetSaveAsFilename"
But when i use SaveAs method to save with the new filename, it saves and opens the new file.
How can i prevent the new file from opening and stay with the existing one?

Or is there anyother way to copy a workbook to a new workbook without opening the new workbook?

Thanks
Veera
 
Veera,
It doesn't actually save and re-open - it just, after saving, resets the workbook.name property to the new name. If you want to continue using the old name, use SaveAs again, with the old name (or, depending on what's happened to the workbook since it was previously saved, you can open the old one). I don't think there is any way you can tell Excel to change the "active name" of the workbook without using save as.
Rob
[flowerface]
 
Once you have the Filename from the user, use the SaveCopyAs method,

e.g ActiveWorkbook.SaveCopyAs "Path:\FileName.xls".

The newly saved filename will not be open, but simply saved to provided path and filename.

A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top