ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save file from the value of cell in different opened file (https://www.excelbanter.com/excel-programming/427693-save-file-value-cell-different-opened-file.html)

Elton Law[_2_]

Save file from the value of cell in different opened file
 
Dear Expert,

I have asked this question before.
Want to save the file name in accordnace to value in cell A1
Activeworkbook.Saves fileName:= Range("A1").Value
But that was supposed to be in same worksheet and file.

Say, if I want to save a file called ABC.XLS to ABC_20090430.XLS via VB
script, the file contains ABC_20090430.XLS is in file OPENFILE.XLS Cell V2
rather than ABC.xls.

So how to fine-tune the VB scripts please ?




Jacob Skaria

Save file from the value of cell in different opened file
 
Assuming you have ABC.xls and Openfile.xls which are already saved and open
the below code will save ABC.xls as the name mentioned in Sheet1 Range V2 of
Openfile.xls..

Workbooks("ABC.xls").SaveAs FileName:=
Workbooks("Openfile.xls").Sheets("Sheet1").Range(" V2")

Once you try this adjust the below code to suit your requirement

If this post helps click Yes
---------------
Jacob Skaria


"Elton Law" wrote:

Dear Expert,

I have asked this question before.
Want to save the file name in accordnace to value in cell A1
Activeworkbook.Saves fileName:= Range("A1").Value
But that was supposed to be in same worksheet and file.

Say, if I want to save a file called ABC.XLS to ABC_20090430.XLS via VB
script, the file contains ABC_20090430.XLS is in file OPENFILE.XLS Cell V2
rather than ABC.xls.

So how to fine-tune the VB scripts please ?




Elton Law[_2_]

Save file from the value of cell in different opened file
 
It works.
Thanks a lot !

"Jacob Skaria" wrote:

Assuming you have ABC.xls and Openfile.xls which are already saved and open
the below code will save ABC.xls as the name mentioned in Sheet1 Range V2 of
Openfile.xls..

Workbooks("ABC.xls").SaveAs FileName:=
Workbooks("Openfile.xls").Sheets("Sheet1").Range(" V2")

Once you try this adjust the below code to suit your requirement

If this post helps click Yes
---------------
Jacob Skaria


"Elton Law" wrote:

Dear Expert,

I have asked this question before.
Want to save the file name in accordnace to value in cell A1
Activeworkbook.Saves fileName:= Range("A1").Value
But that was supposed to be in same worksheet and file.

Say, if I want to save a file called ABC.XLS to ABC_20090430.XLS via VB
script, the file contains ABC_20090430.XLS is in file OPENFILE.XLS Cell V2
rather than ABC.xls.

So how to fine-tune the VB scripts please ?





All times are GMT +1. The time now is 12:03 AM.

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