![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
I created a workbook that use data from another workbook (Data Workbook). The Data Workbook name is changing from time to time. I'm using the Edit/Link/Change Source to update the new link
1. Is there a way to automate the change link procedure ? 2. Is there a way to have the updated link be sored in one of the the spreadsheet cells (as a formula or a link) that will reflect the actual link ? Thanks, Nehemia |
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
You could place some code like below in the Private module of the Workbook Object. Right click on the Excel icon, top left next to file and select "View Code" Then paste in this:
Private Sub Workbook_Open() Dim strOldName As String Dim strNewName As String strOldName = WorksheetFunction.Substitute(Me.Name, ".xls", "") strNewName = Sheet1.Cells(1, 1) ThisWorkbook.ChangeLink Name:=strOldName, NewName:=strNewName, _ Type:=xlExcelLinks End Sub It looks in cell A1 of sheet1 for a FULL path, eg "C:OzGridalpha1.xls" |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|