Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AddIns.Installed error (Word XP )

    OK, I'm stumped and getting more frustrated with each Loop!

    I have a old piece of code that, as of yesterday, seems to be returning an error on every machine here at work. Here is the piece that throws a 5941 (requested member of the collection doesn't exist) error as soon as it tries to evaluate the first "IF":

    If AddIns("wpclite.dot").Installed = True Then
    Set myTemplate = Templates("C:Program FilesMicrosoft OfficeOffice10StartupWPCLite.dot")
    Else
    Set myTemplate = Templates("P:MacrosXPWPCLite.dot")
    End If

    The thing is that the addin most DEFINITELY is there. In fact, I wrote a simple loop to debug things that shows it is indeed a member of the collection:

    For Each tAddIn In AddIns
    Debug.Print tAddIn.Name
    Next

    The only thing that's happened recently was that our infrastructure group pushed out the recent Word security patch (Microsoft KB887978). Does anyone know if there are any reports of adverse effects when that is installed? I swear the code used to work, although since it's so old and not used daily, I can't swear as to when it stopped working, although it most certainly did when I wrote it.

    Can anyone shed some light before I offend someone with my sailor's mouth (which is inextricably linked to Word's VBA Editor)?
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: AddIns.Installed error (Word XP )

    What happens if you try a little session in the immediate window with a blank document open? Here's what I did and what I got in response:

    ?application.AddIns.Item(1).Name
    @WDWORDA.DOT
    ?application.AddIns("@WDWORDA.DOT").Installed
    True
    ?AddIns("@WDWORDA.DOT").Installed
    True

    if AddIns("@WDWORDA.DOT").Installed then msgbox "Works!"
    (Amessage box popped up over Word.)

    ?AddIns("blahblah").Installed
    (5941 error)

    I probably haven't updated Office for a few months now...

  3. #3
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AddIns.Installed error (Word XP )

    Here is a little more information that I have been able to gather since I've been trouble-shooting this issue:

    If I first loop through every addin, stop at the one I'm looking for (by identifying it through it's .NAME property), and get its index, I can use that number instead of the name, and the code works OK. In fact, I can work with a reference to it, gotten by using that approach, but I cannot reference it by name (even in the Immediate window.)

    Most disturbingly, if I exit Word, change the name of the addin, then re-launch Word, I can specify it by its new name; but if I exit Word again and change the name back, the problem reappears.

    So, I can work around the "Returning an object from a collection" issue for now, but I sense a Damoclesian sword lurking on my hard-drive...
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: AddIns.Installed error (Word XP )

    From all clues, it sounds as though you might have a duplicate name. For example, one copy in the Program Files path and one in the user's startup path. Not sure how that could have happened suddenly...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •