Results 1 to 2 of 2

Thread: Excel Add-In Script is not working through Active Setup

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Location
    India, Karnataka, Bangalore
    Posts
    4

    Excel Add-In Script is not working through Active Setup

    Dear All,

    I've wrote the following code to add the XL Add-in.
    ================================================================
    path = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
    sADDIN = path & "\Testing.xla"
    set oXL = CreateObject("Excel.Application")
    oXL.Workbooks.Add
    set oAddin = oXL.Addins.Add(sADDIN, True)
    oAddin.Installed = True
    Set oAddin = Nothing
    oXL.Quit
    Set oXL = Nothing
    ================================================================

    The above code is working fine for me.

    But when executed through Active Setup (for the sake of other users) it didn't work.
    It pops the following error :

    Script : C:\PathoftheFile\AddInAdd.Vbs
    Line : 5
    Char : 1
    Error : Unable to get the Add Property of the AddIns Class
    Code : 800A03EC
    Source: Microsoft Excel

    Note : The Same Code works fine when executed normally. but the problem is while executing through Active Setup.

    Could any one please help me ?

    Thanks & Regards,
    Yogi

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,945

    Re: Excel Add-In Script is not working through Active Setup

    I don't know anything about Active Setup, however when I tried to run your script normally (WScript), it didn't work. Even after creating an Excel addin called "testing.xla" in the same directory as a the script. This was caused by the script blindly assuming that the path variable didn't already end with a backslash when adding the name of the Excel addin.

    Does the following modified version of the script work?
    Code:
    path = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
    '''
    If Not Right(Path, 1) = "\" Then Path = Path & "\"
    sADDIN = path & "Testing.xla"
    '''
    set oXL = CreateObject("Excel.Application")
    oXL.Workbooks.Add
    set oAddin = oXL.Addins.Add(sADDIN, True)
    oAddin.Installed = True
    Set oAddin = Nothing
    oXL.Quit
    Set oXL = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width