Invalid index. when clearing inspector toolbar

Add-in Express™ Support Service
That's what is more important than anything else

Invalid index. when clearing inspector toolbar
Matt Driver


Posts: 152
Joined: 2004-08-17

I have a function called Clear_Inspector_Toolbar which looks like:

WriteDebugLine("Running Function: Clear_Inspector_Toolbar")


WriteDebugLine("Running Function: Clear_Inspector_Toolbar")
WriteDebugLine("Running Line: AdxCmdBarDrpDwn_CP.Clear()")
WriteDebugLine("Running Line: AdxCmdBarDrpDwn_OP.Clear()")
WriteDebugLine("Running Line: AdxCmdBarDrpDwn_SI.Clear()")
WriteDebugLine("Running Line: AdxCmdBarDrpDwn_CT.Clear()")

WriteDebugLine("Calling Function: ClearLists")

If Support_mode = False Then
AdxCmdBarDrpDwn.Visible = True
AdxCmdBarDrpDwn_OP.Visible = True
AdxCmdBarDrpDwn_CP.Visible = True
AdxCmdBarDrpDwn_CT.Visible = True
AdxCmdBarDrpDwn_SI.Visible = True
AdxCmdBarDrpDwn_OP.Visible = False
AdxCmdBarDrpDwn_CP.Visible = False
AdxCmdBarDrpDwn_CT.Visible = False
AdxCmdBarDrpDwn_SI_EX.Visible = True
End If

AdxCmdBarDrpDwn.TooltipText = "Link this e-mail to the selected Pivotal Contact/Company or Lead"
AdxCmdBarDrpDwn_OP.TooltipText = "Link this e-mail to the selected Pivotal Opportunity"
AdxCmdBarDrpDwn_CP.TooltipText = "Link this e-mail to the selected Pivotal Consultancy Project"
AdxCmdBarDrpDwn_CT.TooltipText = "Link this e-mail to the selected Pivotal Contract"
AdxCmdBarDrpDwn_SI.TooltipText = "Link this e-mail to the selected Pivotal Support Incident"

WriteDebugLine("Entering Support Section")
If Support_mode = True Then
AdxCmdBarBtn_CreateSI.Visible = True
AdxCmdBarBtn_CreateSI.Enabled = True
AdxCmdBarBtn_CreateSI.Image = &H3

AdxCmdBarBtn_SI_Type.Visible = True
AdxCmdBarBtn_SI_Type.Enabled = True
AdxCmdBarBtn_SI_Type.Image = 10
AdxCmdBarBtn_SI_Type.TooltipText = "Create a Support Incident of type = Error"

AdxCmdBarBtn_Clipboard.Visible = True
AdxCmdBarBtn_Clipboard.Enabled = True
AdxCmdBarBtn_Clipboard.Image = &H6
AdxCmdBarBtn_CreateSI.Visible = False
AdxCmdBarBtn_Clipboard.Visible = False
AdxCmdBarBtn_SI_Type.Visible = False
End If

WriteDebugLine("Finished Function: Clear_Inspector_Toolbar")
Catch ex As System.Exception
Connected = False
DisableToolbar = True
MsgBox("Pivotal Outlook Mail Integration has encountered a problem and has been disabled. Please restart Outlook to re-enable Pivotal Outlook Mail Integration.", MsgBoxStyle.Information, "Pivotal Outlook Mail Integration Error. 0022")
SaveErrorReport("Function Clear_Inspector_Toolbar:" + Chr(13) + Chr(10) + ex.Message + Chr(13) + Chr(10) + ex.StackTrace)
AdxOlExplorerCmndBar.Enabled = False
AdxOlExplorerCmndBar.Visible = False
AdxOlInspectorCmdBar.Enabled = False
AdxOlInspectorCmdBar.Visible = False
Bulk_InspectorCmdBar.Enabled = False
Bulk_InspectorCmdBar.Visible = False
Cursor.Current = Cursors.Default
End Try

I am getting random crashes when the function gets called which are:

18/07/2006 15:22:16: Function Clear_Inspector_Toolbar:
Invalid index.
at Microsoft.Office.Core._CommandBarComboBox.RemoveItem(Int32 Index)
at AddinExpress.MSO.ADXCustomCommandBarComboBox.ItemRemoveComplete(Int32 index)
at AddinExpress.MSO.ADXStringCollection.Clear()
at AddinExpress.MSO.ADXCustomCommandBarComboBox.Clear()
at Pivotal_Outlook_Mail_Integration.AddinModule.Clear_Inspector_Toolbar()

This is the exception generated and it not my code its actually inside the ADX addin. These errors have been happening for a while now over many builds of ADX and I have been trying to find a solution but have not.

Do you have any ideas what is going on inside when my function above gets called. It is called on:


Is their any chance the inspector object is closing or going out of scope before ADX has finished with it or the index internally to ADX get out of step hence cause the RemoveItem to fail.

I am using the latest build.

Posted 18 Jul, 2006 11:22:42 Top
Sergey Grischenko

Add-in Express team

Posts: 7225
Joined: 2004-07-05
Hi Matt.

I can't reproduce the issue. What should I do to get this error on my PC? Probably you can send me the code that raises the error.
Posted 18 Jul, 2006 12:22:00 Top
Matt Driver


Posts: 152
Joined: 2004-08-17

Its probably to much effort as it involves a 6GB database, 10' of Active X controls, and a CRM client which I cannot send to you due to confidential info etc. I am currently rewriting the whole thing in C# streamlining everything so Its probably best to see if it does the same thing then as my VB app is a bit code heavy and maybe causing performance issues.

Posted 19 Jul, 2006 04:29:58 Top