I have a report dashboard in WB1 that has linked pictures of charts from another workbook WB2 (PASTE/SPECIAL PASTE/LINKED PICTURE)
The sales team is updating WB2 and linked pictures in WB1 do not update unless both workbooks are open.
So I had a work around by implementing a button in WB1 to open and close WB2 and that updated the links.
Now for some reason that stopped working. The only change I did was change the WB2 into a workbook with a macro (it now auto updates all graphs when new values are added).
Sub Gumb214_Klikni()
'Button to open and close WB2
Dim xWb As Workbook
Dim wbName As String
On Error Resume Next
Set xWb = Workbooks.Open("path to link")
wbName = xWb.Name
Workbooks("name of folder").Close
If Err.Number <> 0 Then
MsgBox "This workbook does not exist!", vbInformation, "ERROR"
Err.Clear
Else
MsgBox "TEXT"
End If
End Sub
The catch is that even if I return to the old way to a non macro WB2 the button stopped refreshing the picture links and they are only refreshed it you manually open them or have both workbooks open.
Is there any other way to update linked pictures? This is driving me nuts since it worked fine before I tried to save time and auto refresh WB2 graphs.
To expand on my comment. Updating them this way will make it look seamless to the end user and give the false impression that the destination workbook wasn't 'opened'
Sub Gumb214_Klikni()
'Button to open and close WB2
Dim xlApp As New Excel.Application
Dim xWb As Workbook
Dim wbName As String
On Error Resume Next
With xlApp
.Visible = False
Set xWb = .Workbooks.Open("path to link")
End With
wbName = xWb.Name
Workbooks("name of folder").Close
If Err.Number <> 0 Then
MsgBox "This workbook does not exist!", vbInformation, "ERROR"
Err.Clear
Else
' Update pictures here via whatever method and save&close the destination workbook
MsgBox "TEXT"
End If
' Quit the second instance of the application
With xlApp
.Quit
End With
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.