none
Application Object “Out Of Range” Error Initializing Legacy VB6 COM-Addin for Outlook 2013 RRS feed

  • Question

  • I'm attempting to ensure compatibility for an old VB6 COM-addin for Outlook 2013. It's worked fine (more or less) for every version since 2002 but in testing 2013 I'm getting an odd error when I attempt to initialize.

    As soon as I try to take ANY action on the Outlook Application object I blow up with a "09 - Subscript Out Of Range" error. Even something as benign as casting the the olApp parameter I'm bringing into the class as a private var blows up. The Application object isn't null, it's property rich and seemingly initialized.

    Friend Sub InitHandler(olApp As Outlook.Application, strProgID As String)
    
    On Error GoTo ErrorExit
    
    'If Outlook is opened without main UI (i.e. 'mailto:' HTML link)
    If Explorers.Count = 0 Then Exit Sub
    
    ' BLOWS UP SO TRIED COMMENTING IT OUT AND ACCESSING PARAMETER DIRECTLY
    'Set objOutlook = olApp
    
    ' ALSO BLOWS UP
    Set objNameSpace = olApp.GetNamespace("MAPI")
    
    ...

    Have there been any major architectural changes to the object model? Any ideas?

    Thursday, December 12, 2013 6:13 AM

Answers

  • The issue here was the need for the Vb6 service pack and cumulative rollout update.  Consider this closed.
    • Marked as answer by RyanMac Thursday, December 12, 2013 11:43 PM
    Thursday, December 12, 2013 11:43 PM

All replies

  • Hello RyanMac,

    Is your add-in loaded in Outlook?

    Anyway, there were no breaking changes, so your add-in (suppose it implements the IExtensibility2 interface) should work as it worked before. Did you try to debug the code? What line (or lines) of code fires the exception?

    Also I have found the Subscript out of range (Error 9) description in MSDN. Please check out the points listed in the article.

    Thursday, December 12, 2013 8:42 AM
  • I did.  Like I said, it blows up with the ERROR 9 (of which I'm quite familiar in normal context) as soon as I work with the Application object in any capacity.

    Whether it's this line...

    Set objOutlook = olApp

    Or this line..

    Set objNameSpace = olApp.GetNamespace("MAPI")
    

    It's blows up with a subscript error rendering my add-in DOA.  It won't crash the add-in since I handle the error - so it will load - but it's not initialized by any stretch.

    Thursday, December 12, 2013 4:19 PM
  • A subscript error when - essentially - setting A = B seems to suggest an internal error.
    Thursday, December 12, 2013 4:23 PM
  • The issue here was the need for the Vb6 service pack and cumulative rollout update.  Consider this closed.
    • Marked as answer by RyanMac Thursday, December 12, 2013 11:43 PM
    Thursday, December 12, 2013 11:43 PM
  • Hello Ryan,

    Thank you for letting us know the real cause. Hope it will help others.

    Friday, December 13, 2013 7:36 AM