+ Reply to Thread
Results 1 to 5 of 5

ChangeLinks results in directory prompt for each link

  1. #1
    Registered User
    Join Date
    08-19-2013
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    17

    Question ChangeLinks results in directory prompt for each link

    The macro below is to update each link flagged with a "Yes".

    However, running the macro resulted in getting a directory prompt for each link,
    although all of the old files were in one folder and all of the new files were in their own separate folder.

    Both OldLinks and NewLinks are filenames with full paths.

    Do I need to change directories or something?

    PHP Code: 
    Sub UpdateLinks()
        
    Sheets("Link Summary").Select
        LinkCount 
    = (Range(Range("A2"), Range("A9999").End(xlUp)).Rows.Count 5) / 2
        
        Rows
    ("1:1").Select
        Selection
    .Find(What:="Update?"After:=ActiveCellLookIn:=xlValues).Activate
        Set Changes 
    ActiveCell.EntireColumn.SpecialCells(xlCellTypeFormulas23)
        
    Changes.Select      '''This is a single column containing a Yes/No flag
        
        For x = 1 To LinkCount
            If Changes(x) = "Yes" Then
                OldLink = Range("A" & Changes(x).Row).Value
                NewLink = Changes(x).Offset(0, 1).Value
                ActiveWorkbook.ChangeLink Name:=OldLink, NewName:=NewLink, Type:=xlExcelLinks
            End If
            Changes.Select
        Next x
        
        MsgBox "Finished!"

    End Sub 

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ChangeLinks results in directory prompt for each link

    You can insert this line to break the link

    Please Login or Register  to view this content.
    And may add

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-19-2013
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    17

    Re: ChangeLinks results in directory prompt for each link

    Thanks AB33.
    I will give it a try when I get back to that file;
    is there a quick way to reset these settings to whatever they were before the macro was run?

    Thanks,

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ChangeLinks results in directory prompt for each link

    You can manually break a link, but if you want to auto, you put it at the top of the code and re-state it at the bottom. So, when the code runs, it ignores the link.
    You can have look at your options settings where you can permanently break a link.
    Last edited by AB33; 01-11-2014 at 06:01 AM.

  5. #5
    Registered User
    Join Date
    08-19-2013
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    17

    Re: ChangeLinks results in directory prompt for each link

    Works great!

    My coding may not be the shortest, but it is nice to know that
    1) it works, and
    2) it is getting better.

    Thanks AB!

    Anil

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Buttons to prompt for directroy. Paste directory location in corresponding cell.
    By mamero in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-27-2013, 09:19 PM
  2. [SOLVED] Prompt to insert user name in directory
    By jh51745 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2013, 10:01 AM
  3. Prompt User for Directory(folder)
    By cocotrp in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-14-2011, 06:37 PM
  4. Replies: 3
    Last Post: 06-11-2009, 07:08 PM
  5. prompt user to specify a directory
    By mini in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2006, 01:10 AM

Tags for this Thread

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