+ Reply to Thread
Results 1 to 2 of 2

ChangeLink Name Issues

  1. #1
    Registered User
    Join Date
    11-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    1

    Question ChangeLink Name Issues

    Hi,

    I'm all but about to give up with with macro. I am trying to Update a link in Excel 2007. The new file name will be the same but it is a new location.

    This is the standard basic record macro code (that works):

    XXX = Source Path
    YYY = File Name

    -----
    ChDir _
    "XXX"

    ActiveWorkbook.ChangeLink Name:= _
    "XXXYYY.xlsx" _
    , NewName:="YYY.xlsx", Type:=xlExcelLinks
    -----
    Simplest looking macro ever, I want to make XXX dynamic using cell D1 named SourceLoc, why doesn't this work:

    -----
    Dim LinkLoc As String

    LinkLoc = Sheets("Start Numbers").Range("SourceLoc")

    ActiveWorkbook.ChangeLink Name:=LinkLoc, NewName:="YYY.xlsx", Type:=xlExcelLinks
    -----

    Even if I add in ChDir, change to ThisWorkbook or any bits like that i cannot seem to get it to work, it doesn't seem to like the syntax of ActiveWorkbook.ChangeLink Name:=LinkLoc,

    Thoughts?

  2. #2
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    157

    Re: ChangeLink Name Issues

    Have you tried to use the range, itself as a reference?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1