VBA xl2003- Edit Links, Change Source

iainmartin100

New Member
Joined
Mar 9, 2011
Messages
43
Hi,

Iv'e searched the forum but unfortunatly can't find the answer, hoping someone can help.

If in the current workbook I have a link to another workbook how can I have a marco to bring up the Edit>Links dialog box and then selects change source?

To make life easier say I have the link is in Sheet1,cell A1 - do I need to refrance this cell to extract the link? and how.

Basiclly I want to do the below, the only issue is that the current link name 123.xls may change and the new link 456.xls will be user difined:

ActiveWorkbook.ChangeLink Name:= _
"C:\123.xls", _
NewName:= _
"C:\456.xls", _
Type:=xlExcelLinks

Any help would be really appriciated.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I have managed to solve the problem :-) I have posted the resolution below to help if anyother people have a simular issue. Thanks

Sub Link_Update()
ChDrive "c"
ChDir "c:/"
alink = ThisWorkbook.LinkSources
If IsEmpty(alink) Then
MsgBox "No links found"
ElseIf UBound(alink) = 1 Then
Application.Dialogs(xlDialogChangeLink).Show alink(1), "", 1
Else
MsgBox "More than 1 link found"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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