PC Review


Reply
Thread Tools Rate Thread

Addin instalalltion throught a vbscript

 
 
Desaivres Alain
Guest
Posts: n/a
 
      16th Mar 2010
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.name)"
then
"appXL.application.Addins(objFileToInstall.name).installed = true
But not working neither...

Thanks for your help
Alain
 
Reply With Quote
 
 
 
 
Desaivres Alain
Guest
Posts: n/a
 
      16th Mar 2010
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").Installed = 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


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      16th Mar 2010
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" <(E-Mail Removed)> wrote in
message newsAA2351F-3E22-4B48-B2C4-(E-Mail Removed)...
> 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").Installed = 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
>
>



 
Reply With Quote
 
Desaivres Alain
Guest
Posts: n/a
 
      16th Mar 2010
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
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      16th Mar 2010
Sorry those last two lines were the wrong way around


appXL.Quit
Set appXL = Nothing

--

HTH

Bob

"Bob Phillips" <(E-Mail Removed)> wrote in message
news:u%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in
> message newsAA2351F-3E22-4B48-B2C4-(E-Mail Removed)...
>> 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").Installed = 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
>>
>>

>
>



 
Reply With Quote
 
Gary Brown
Guest
Posts: n/a
 
      16th Mar 2010
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

 
Reply With Quote
 
Desaivres Alain
Guest
Posts: n/a
 
      16th Mar 2010

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

appXL.Quit
Set appXL = Nothing


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set a reference to Microsoft VBScript Regular Expressions(vbscript.dll) cate Microsoft Excel Programming 3 1st Dec 2009 03:07 PM
Multiple Excel addin versions having LaodBehaviour issue at Addin Dwipayan Das Microsoft Excel Programming 0 17th Apr 2009 05:51 AM
Unable to call a vbscript within a vbscript Karuna Microsoft Access VBA Modules 1 6th Oct 2008 02:12 PM
Using VBScript behind Outlook forms with a COM-AddIn Justin Williams via OfficeKB.com Microsoft Outlook Program Addins 1 21st Apr 2005 02:45 PM
howtofix excel 2000 says invalid AddIn for valid excel97 AddIn robm Microsoft Excel Discussion 0 24th Sep 2003 06:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 AM.