Identifying un-installed AddIns (Word/VBA 2003) (Solved?)

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15587
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Identifying un-installed AddIns (Word/VBA 2003) (Solved?)

Post by ChrisGreaves »

I'm trying to build (attached) a list of all the addins available.

Code: Select all

Public Function lngAddinsCount(strAddins() As String) As Long
    ' Build an array of current AddIns; return the count
    ReDim strAddins(0)
    Dim lngHits As Long
    Dim ad As AddIn
    Dim lng As Long
    For lng = 1 To AddIns.Count
        Set ad = AddIns(lng)
        Call LogFile(strcApplication, "lngAddinsCount - Addin " & ad.Name & vbTab & ad.Installed)
        If ad.Installed Then
            strAddins(UBound(strAddins)) = ad.Name
            ReDim Preserve strAddins(UBound(strAddins) + 1)
            lngHits = lngHits + 1
        Else
        End If
    Next lng
    If UBound(strAddins) > 0 Then
        ReDim Preserve strAddins(UBound(strAddins) - 1)
    Else
    End If
    lngAddinsCount = lngHits
End Function
The code fails on the line " ... " & ad.Name & vbTab & ad.Installed)", claiming Run Time Error 5152 method 'name' of object 'ad' failed.

I have reason to believe my code is trying to look at the MMX015 addin
11.png
The Locals window shows me that the object ad exists, and is NOT installed.
10.png
I'm having trouble understanding why (design!) Word won't let me at least see the name of something that it can show to the end-user.

I can test for .Installed before trying to use the .Name, but then I won't be seeing the .Name anyway.

I could examine all files in the various template folders (StartUp, User, WorkGroup etc.) and list all the files there, but to my mind that's not the same as me, the programmer, trying to help you, the end-user, understand why your addins aren't working.

:hairout: :scratch: :sad: :blowup: :boxedin: to name a few ...
You do not have the required permissions to view the files attached to this post.
Last edited by ChrisGreaves on 05 Jul 2011, 18:56, edited 1 time in total.
There's nothing heavier than an empty water bottle

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15587
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Identifying un-installed AddIns (Word/VBA 2003)

Post by ChrisGreaves »

ChrisGreaves wrote:I'm having trouble understanding why (design!) Word won't let me at least see the name of something that it can show to the end-user.
(minutes later ...) I'm also having trouble wondering why I am allowed to wander on the face of this sweet planet.

I think that the MMC015.dot, of all the templates that is NOT installed, is the only (uninstalled) template that does not exist.

Its path is listed as "B:\Deploy", where "B:\" is my daily Blotter drive, and a week or two ago, on the B:\ folder of that day, I had prepared a zip package for deployment in B:\Deploy\, of all places.

Today's B:\ does NOT have a \deploy\, and so does not have a B:\Deploy\MMC015.dot.

So presumably I trap the error and suppose to the end-user that there is an addin, visible to the end-user in the (Word 2003) Tools, Templates and AddIns list that (used to be in a folder that) no longer exists, but since WordVBA won't tell me the name of it, I can't help the end-user to identify it.

And obviously searching folders won't do me any good at all in this case.

The best I can do is throw up a list in Notepad and ask the end-user to compare, by eyeball, the two lists and, perhaps, delete the extra entries from the user's list.

No where's that :barf: smiley?
There's nothing heavier than an empty water bottle

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15587
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Identifying un-installed AddIns (Word/VBA 2003)

Post by ChrisGreaves »

ChrisGreaves wrote:So presumably I trap the error ...
And now that I've got you all stirred up, ...

Here's the first "working" version of the code.

I have emailed a copy of the template to my client with instructions to run it and email the log file(s) back to me.
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle