Check that the TypeName function does not return Nothing when run on the ActiveInspector method of the Application object:
Sub active() If TypeName(Application.ActiveInspector) = "Nothing" Then MsgBox "No item is open." End End If End Sub