View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_4_] Bob Phillips[_4_] is offline
external usenet poster
 
Posts: 834
Default Addin instalalltion throught a vbscript

See if this works

Set appXL = CreateObject("Excel.Application")
Set objFileToInstall = oFSO.GetFile(objTargetFolder & "\" & file.name)
For Each objAddin In appXL.Application.addins
If objAddin.name = ObjFileToInstall.Name then
If Not objAddin.installed Then
On Error Resume next
objAddin.installed = False
objAddin.installed = True
If Err < 0 Then
WScript.Echo " ... " & "Err.description: " & Err.Description
Else
WScript.Echo " ... " & objAddin.name & " installed..."
End If
Else
WScript.Echo " ... " & objAddin.name & " already installed..."
End If
End If
Next
Set appXL = Nothing
appXL.Quit

--

HTH

Bob

"Desaivres Alain" wrote in
message ...
In addition...

Assuming the file function.xla is already available in the default Addin
folder
If I run those lines in my script
Set appXL = CreateObject("Excel.Application")
appXL.Application.Addins.Add("addin.xla").Installe d = True

I get this error
Err.description: Unable to get the Add property of the AddIns class

Any idea ? Does it mean the Addin collection cannot b manipulated into
vbscript ?

Thanks
Alain