ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing File Names and Linking Cells between workbooks (https://www.excelbanter.com/excel-programming/346026-changing-file-names-linking-cells-between-workbooks.html)

James

Changing File Names and Linking Cells between workbooks
 
Hello,

I have one master Workbook where I am bringing worksheets in from other
Workbooks. Some of the cells are linked with Name, Date, and Project Number
which resides in the master workbook and must transfer when the worksheet is
brought in.. My Problem is: My master workbook can change names which
affects the linked data file name in the worksheets I am bringing in. The
code in the linked cell reads ='Z:\Project Forms XLS\[My Project
Template.xls]Menu'!$E$5 but my file name can change. Can I use a variable
or something in my linked data to accommodate changing master worksheet file
names?


chijanzen

Changing File Names and Linking Cells between workbooks
 
James:

try it,


ActiveWorkbook.ChangeLink "Z:\Project Forms XLS\My Project Template.xls", _
"Z:\Project Forms XLS\My Project Template-1.xls", xlExcelLinks

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"James" wrote:

Hello,

I have one master Workbook where I am bringing worksheets in from other
Workbooks. Some of the cells are linked with Name, Date, and Project Number
which resides in the master workbook and must transfer when the worksheet is
brought in.. My Problem is: My master workbook can change names which
affects the linked data file name in the worksheets I am bringing in. The
code in the linked cell reads ='Z:\Project Forms XLS\[My Project
Template.xls]Menu'!$E$5 but my file name can change. Can I use a variable
or something in my linked data to accommodate changing master worksheet file
names?



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

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