Workbooks.Open updatelinks is not working

Kamolga

Well-known Member
Joined
Jan 28, 2015
Messages
1,185
Hi,

I have 2 workbooks linked on the server: workbook 2 has a vlookup formula with the table array in workbook 1. When I open workbook 2, I have a value error cell, even if workbook 1 is opened. If I manually close workbook 1 and reopen it, I have the right value. If I do it with a macro, I have error value.

I have ticked and unticked the "let user choose" and my preference definitely goes to don't display alerts and update links.

What I don't understand is why does it work if I do it manually but not through VBA.

In addition, normally if you close workbook 1 and check status is edit links, it goes from unknown to waarning! Values referring to other workbooks were not updated. Here it shows OK.

Those are a bit of everything I tried. It opens workbook 2 but nothing happens. Dag_Prod is the name of workbook 1.
Code:
Dim arrlinks, i As Integer
Application.DisplayAlerts = False
'On Error Resume Next
arrlinks = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(arrlinks) Then
For i = 1 To UBound(arrlinks)
Workbooks.Open arrlinks(i), UpdateLinks:=3
'Debug.Print arrlinks(i)
Next i
End If
Dag_Prod.Activate
'ThisWorkbook.UpdateLink Name:=ThisWorkbook.LinkSources
Calculate
Dag_Prod.RefreshAll
Dag_Prod.Save
On Error GoTo 0
Application.DisplayAlerts = True

Any bit of help is welcome.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,226,112
Messages
6,189,039
Members
453,521
Latest member
Chris_Hed

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