ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Another Save Question (https://www.excelbanter.com/excel-worksheet-functions/143378-another-save-question.html)

Sandy

Another Save Question
 
The following 1) Save a workbook 'as' and then closes it - followed by 2)
the original book 'Not Saved' and then closing.
Is it possible to have the workbook 'saved as' without it closing and still
have the original book close without saving


ThisWorkbook.SaveCopyAs Filename:="Personal Data-" & inputText & ".xls"

ThisWorkbook.Close SaveChanges:=False

Sandy



Barb Reinhardt

Another Save Question
 
I'm confused as to what you are asking. When you execute the first line, it
saves "ThisWorkbook" with a new name. The workbook name that Excel knows is
the original workbook name.

Basically, you're saying that you want to have a file call "Personal ..."
opened after it's saved.

Try something like this

You'll need to enter the entire file path where it has filename.

Dim oWB as workbook
set oWB = workbooks.open(filename,UpdateLinks:=False)


Then you'll have a workbook called ThisWorkbook and another called oWB

"Sandy" wrote:

The following 1) Save a workbook 'as' and then closes it - followed by 2)
the original book 'Not Saved' and then closing.
Is it possible to have the workbook 'saved as' without it closing and still
have the original book close without saving


ThisWorkbook.SaveCopyAs Filename:="Personal Data-" & inputText & ".xls"

ThisWorkbook.Close SaveChanges:=False

Sandy





All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com