Dear Reader,
I am using workbook open event to open the linked file. The linked workbook is running in background. I am not changing anything in the opened linked file.
I have a query, when I close my master sheet, will the linked workbook also get closed.
How do I close the opened link files, when the master sheet is closed?
The VBA code to open linked files.
Note: I needed to open the linked files since I have named ranges referring another workbook.
Regards,
Naveen N
I am using workbook open event to open the linked file. The linked workbook is running in background. I am not changing anything in the opened linked file.
I have a query, when I close my master sheet, will the linked workbook also get closed.
How do I close the opened link files, when the master sheet is closed?
The VBA code to open linked files.
Note: I needed to open the linked files since I have named ranges referring another workbook.
Code:
Private Sub Workbook_Open()
Dim LinkList As Variant
On Error Resume Next
LinkList = ThisWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(LinkList) Then
For i = LBound(LinkList) To UBound(LinkList)
Application.Workbooks.Open Filename:=LinkList(i), UpdateLinks:=False, ReadOnly:=True
ActiveWindow.Visible = False
Next i
End If
ThisWorkbook.Activate
End Sub
Regards,
Naveen N
Last edited by a moderator: