ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save As Filename (https://www.excelbanter.com/excel-programming/433821-save-filename.html)

Dow

Save As Filename
 
I have looked through every post I could find related to this and I am
not seeing what I need. I hope someone will be able to help me.

I have written a combination of macros that make some format changes
to a workbook then add some formulas and finally I get a finished
product.

Halfway through the macros I want to insert code or another macro that
will save the workbook at that point, with it's current name, to a
fixed location, and then continue working to finish the rest of the
formulas and equations. I will save the finished product with a
different name in a different location.

I can then use the originally saved file with the formating done up to
that point for something else.

Does anyone have any thoughts on how to do this? I have been looking
at getfilesaveas and a number of other things but I am not able to
make them work for what I want.

Thanks as always.

Dow.


joel

Save As Filename
 
You need to perform the saveas and then open the original workbook back up

set bk1 = activeworkbook
'get pathaname of original file
bkname = bk1.fullname

'make c hange to original workbook

'save changes as new workbook.
bk1.saveas filename:="c:\temp\book2.xls"
'the original workbook is closed during the saveas

'open original workbook without modifications
'modifications got saved as in new book
set bk2 = workbooks.open(filename:=bkname)


"Dow" wrote:

I have looked through every post I could find related to this and I am
not seeing what I need. I hope someone will be able to help me.

I have written a combination of macros that make some format changes
to a workbook then add some formulas and finally I get a finished
product.

Halfway through the macros I want to insert code or another macro that
will save the workbook at that point, with it's current name, to a
fixed location, and then continue working to finish the rest of the
formulas and equations. I will save the finished product with a
different name in a different location.

I can then use the originally saved file with the formating done up to
that point for something else.

Does anyone have any thoughts on how to do this? I have been looking
at getfilesaveas and a number of other things but I am not able to
make them work for what I want.

Thanks as always.

Dow.




All times are GMT +1. The time now is 11:42 PM.

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