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!