How to enter a link path in one of the cells in a worksheet

G

Guest

Guest
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
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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"
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top