Feb 12 2020 07:52 PM - edited Feb 12 2020 07:55 PM
I have a Excel with Macro which was developed in O365. It's running fine and without issue before. However, recently the Excel on server has been changed from O365 to Excel 2016. Then I found the Macro will throw Error 424 when it is trying to close the objects. The code that highlighted in red is where I found it will throw error when I debug.
Dim VBP As VBProject, oWin As VBIDE.Window
Dim wbActive As Workbook
Dim i As Integer
Set VBP = WB.VBProject
Set wbActive = ActiveWorkbook
' Close any code windows To ensure we hit the right project
For Each oWin In VBP.VBE.Windows
If InStr(oWin.Caption, "(") > 0 Then oWin.Close
Next oWin
When I debug in O365, system shows the "Object Browser" in Caption.
But in Excel 2016, it is unable to define and oWin.Caption is <Object required>.
Now, I'm wondering if the object library is lost during the Excel version uninstall and changing process.
Please help and advise. Thanks.