ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Addin instalalltion throught a vbscript (https://www.excelbanter.com/excel-programming/440685-addin-instalalltion-throught-vbscript.html)

Desaivres Alain

Addin instalalltion throught a vbscript
 
Hi - I am afraid I need some help

Here is the script I am running for an Addin installation and unfortunately
the Excel object created do not dissapear after putting it to nothing... I am
then obije to kill it and the installation is not done...

Here is my script... the xla file is suposed to be already available...

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 = 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

Everything run properly except the "objAddin.installed = True" instruction
I have also tried
"appXL.Application.Addins.Adds(objFileToInstall.na me)"
then
"appXL.application.Addins(objFileToInstall.name).i nstalled = true
But not working neither...

Thanks for your help
Alain

Desaivres Alain

Addin instalalltion throught a vbscript
 
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



Bob Phillips[_4_]

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





Desaivres Alain

Addin instalalltion throught a vbscript
 
Another additional information

If the Addin is already installed... the simple fact to run thos lines
create an Excel process that do not close... then I need to kill it through
task manager

Lines

Set appXL = CreateObject("Excel.Application")
If appXL.Application.Addins("addin.xla").Installed = True then
End if
set appXL = Nothing

As if the simple fact to manipulate the Addins collection was producing the
fact the Excel.exe do not close any more...

Thanks
Alain

Bob Phillips[_4_]

Addin instalalltion throught a vbscript
 
Sorry those last two lines were the wrong way around


appXL.Quit
Set appXL = Nothing

--

HTH

Bob

"Bob Phillips" wrote in message
...
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







Gary Brown[_5_]

Addin instalalltion throught a vbscript
 
How about something simple like....

application.addins.add objTargetFolder & "\" & file.name


--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Desaivres Alain" wrote:

Another additional information

If the Addin is already installed... the simple fact to run thos lines
create an Excel process that do not close... then I need to kill it through
task manager

Lines

Set appXL = CreateObject("Excel.Application")
If appXL.Application.Addins("addin.xla").Installed = True then
End if
set appXL = Nothing

As if the simple fact to manipulate the Addins collection was producing the
fact the Excel.exe do not close any more...

Thanks
Alain


Desaivres Alain

Addin instalalltion throught a vbscript
 

Fantastic those two lines are the solution !!!
Great // Thanks to you // Alain

appXL.Quit
Set appXL = Nothing




All times are GMT +1. The time now is 03:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com