Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

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

  1. #1
    Guest

    Default

    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. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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"



Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •