Link to home
Start Free TrialLog in
Avatar of jonathan_hills
jonathan_hillsFlag for Canada

asked on

Install Excel Add-in Using VBS

Hi,
I am trying to install an Excel add-in called PTSREPORTS.xla.  The question is how do you install this add-in using only a vb script? FYI I am pretty clueless when it comes to vbs. The script is being called from an installer.exe I already created so I will not already have Excel open when running the script.
ASKER CERTIFIED SOLUTION
Avatar of MWGainesJR
MWGainesJR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jonathan_hills

ASKER

Okay thank you. For clarification if anybody else if having issues with this, for actually installing the add-in from VBScript, you use something like this.

'''open Excel
Set xlApp = CreateObject("excel.application")

xlApp.Visible = False

With xlApp
   .Workbooks.Add
   .Application.Addins.Add(.Application.TemplatesPath & "PTSREPORTS.xla").Installed = True
   Set a = .Application.AddIns("For Test")       'The Title - In Properties - Summary
    If a.Installed = True Then
        Sh.PopUp "PTSREPORTS.xla installed !",6,"Confirmation !!!",48
    Else
        MsgBox "Problems !?!"
    End If
End With

'''exit Excel
xlApp.Quit

This is so that in your .xla file you could have the following:

Private Sub Workbook_AddinInstall()
   
    Debug.Print "Installing PTS Reports Add-in"
   
    InstallMainMenu
    version.WriteVersionToRegistry

End Sub

This code is not in working condition, but gives an idea of how too actually install the add-in.

**Instead of TemplatesPath or xlStart the default for excel is actually "C:\Documents and Settings\user\Application Data\Microsoft\AddIns"