/build/static/layout/Breadcrumb_cap_w.png
08/28/2018 467 views
0down votefavorite

I need help with a script that will remove an MS Word Add-in from the MS Word Templates and Add-ins collection. The add-in is called “Wordaddin.dotm”. The issue I have is if this add-in (package) is uninstalled, MS Word continues showing the option in Add-ins. Clicking on the (dead) option returns a message “The macro cannot be found or has been disabled…”. I understand that Wordaddin.dotm has to be removed from the Add-ins collections in MS Word for the link to no longer show in MS Word Add-ins. I found a partial script I was hoping to get help in filling in the blanks. Not sure if it matters what is the path to the Add-in, but as follows:

[Appdatafolder]\Microsoft\Word\Wordaddin.dotm


Partial script as follows:

[vba]Sub RemoveUnusedAddin()

Dim oAddin As AddIn

For Each oAddin In AddIns

 If oAddin.Installed = False Then

 AddIns(oAddin.Path & "\" & oAddin.Name).Delete

 End If

 Next

 End Sub[/vba]

I tried running this vb script but am getting a syntax error on line 1, character 6. I’m sure that is not all that is wrong or missing from this script. Also, source of this script mentions no need to include a path as scripted. Source of my partial script: http://www.vbaexpress.com/forum/showthread.php?45109-How-to-remove-(Delete)-a-Word-global-template-add-in-from-the-Add-ins-list

Thank you in advance!

0 Comments   [ + ] Show comments

Comments



Community Chosen Answer

1
Add-in information is derived from registry data in HKEY_CURRENT_USER. The script you have won't touch that so you need to do more work (much more, actually).

Seek out Captain Planet's script for Excel add-ins. It was built to be used in Windows Installer Custom Actions but you can take much of what he's written and shoe-horn it in to a script of your own. It'll also give you an idea of how simplistic the script you're currently using is. And yes, I know yours is a Word add-in but the principles are identical.
Answered 08/29/2018 by: VBScab
Red Belt

All Answers

0
Hi,
this is the link you are looking for, VBScabs suggestion.

Cheers
Phil
Answered 09/04/2018 by: Pressanykey
Red Belt