Thanks MrShorty.
As a VBA novice (and likely to remain one) I'm afraid most of that is over my head. And the more I dug into it (early binding, late binding, type libraries, application references, object declarations, etc) the more lost I became.
But I latched onto your suspicion: "I am guessing that your personal.xlsb has a Type statement somewhere that defines what a DataObject type contains." As you'll have seen from my last few replies, I have it working now (in any of three forms). But I'm still curious as to why it worked before in PERSONAL.xlsb, before I had seen bakerman2's point about a "reference to Microsoft Forms 2.0 Object Library". So I've just searched the PERSONAL 'project' using the target 'Type'. From its scores of macros, only this one below gave a hit. (Can't remember its source.) Do you think this could be the answer to the puzzle?
![]()
Sub CloseAllVBEWindows() 'CR v5207 'Closes all VBE windows except this one! 'Requires library 'Microsoft Visual Basic for Applications Extensibility' 'CR 02/02/2016 - added error handling to fix issue in 64-bit Office 'In My Tab On Error GoTo Err_Handler Dim vbWin As Object Const vbext_wt_CodeWindow = 0 Const vbext_wt_Designer = 1 For Each vbWin In Application.VBE.Windows If (vbWin.Type = vbext_wt_CodeWindow Or _ vbWin.Type = vbext_wt_Designer) And _ Not vbWin Is Application.VBE.ActiveWindow Then vbWin.Close End If Next Exit_Handler: Exit Sub Err_Handler: If Err.Number = 424 Then Resume Next 'object required MsgBox "Error " & Err.Number & " in CloseAllVBEWindows procedure: " & Err.Description Resume Exit_Handler End Sub
Bookmarks