Solved

Install Excel Add-in Using VBS

Posted on 2010-09-15
2
1,147 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:jonathan_hills
2 Comments
 
LVL 13

Accepted Solution

by:
MWGainesJR earned 500 total points
ID: 33682824
Can you just copy the xla to the xlstart folder? "C:\Program Files\Microsoft Office\Office10\xlStart
0
 

Author Comment

by:jonathan_hills
ID: 33684007
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"
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now