VBA LOOP

sh1pley

Board Regular
Joined
Dec 22, 2006
Messages
160
Hi

I want to loop through some code until this statement is true:

ActiveWorkbook.ChangeLink Name:=OldPath, NewName:=NewPath, Type:=xlExcelLinks

Any ideas?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Here is a function that returns True if the argument passed to it is the path to a Link in the workbook:

Code:
Function IsLinkSource(LinkPath As String) As Boolean
    Dim i As Integer
    On Error Resume Next
    i = WorksheetFunction.Match(LinkPath, ThisWorkbook.LinkSources, False)
    If Err = 0 Then
        IsLinkSource = True
    Else
        Err.Clear
        IsLinkSource = False
    End If
End Function

I tested it like this:

Code:
Sub T()
    Const OldPath As String = "P:\TEMP\MrExcel\FileLinks\Source.xls"
    MsgBox IsLinkSource(OldPath)
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,282
Messages
6,171,174
Members
452,387
Latest member
Lorenzo_Barry

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