This is bothering me for a years now, I would like to open another workbook using VBA and copy worksheet to the current workbook and close it. Another workbook can be also macro enabled workbook. My method is following:
Application.DisplayAlerts = False
Dim workBookName1 As String
Application.AutomationSecurity = msoAutomationSecurityForceDisable
Application.AutomationSecurity = msoAutomationSecurityLow
Workbooks.Open fileName:="C:\test.xlsm", ReadOnly:=True
workBookName1 = ActiveWorkbook.Name
'some work with copying, filtering, etc.
With Workbooks(workBookName1)
.Close
End With
BUT the issue is that is not bulletproof -> sometimes this procedure closes all opened workbooks.
is there any other way to deal with this, maybe another method to try it?