Pages

Showing posts with label remove excel addin using vbscript. Show all posts
Showing posts with label remove excel addin using vbscript. Show all posts

Monday, 16 July 2012

Remove Excel Addin - VBScript

Following VBScript can be used to delete Excel Addin
Change AddIn_path to the Excel Addin file that needs to be removed


Set objArg = WScript.Arguments
AddIn_path = objArg(0)
AddIn_path = "C:\Program Files\FO PROD\SalesXL.xla"

strKeyPath = ""
oReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
    'msgbox subkey

strKeyPath = subkey & "\SOFTWARE\Microsoft\Office\11.0\Excel\Options"

oReg.EnumValues HKEY_USERS, strKeyPath,_
arrValueNames, arrValueTypes

X = """" & AddIn_path & """" 

For i=0 To UBound(arrValueNames)

oReg.GetStringValue HKEY_USERS,strKeyPath,arrValueNames(i),strValue

If (left(arrValueNames(i), 4) = "OPEN") Then
  If strValue = x  Then
oReg.DeleteValue HKEY_USERS,strKeyPath,arrValueNames(i)
'msgbox strKeyPath & "\" & arrValueNames(i)
End If
End If   

Next
Next