WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Create Excel Addin


Question:

I have an .xla file that I need to add to everyone's excel as an Add-in. Does anyone know of any code that will help me do this?

I checked the tech database, but all I saw was code to query for Addins already installed.

Answer:

Here's some code that should work.
sAddinFile = "C:\TestAddin\TestToolbar.xla" ;The addin file to add to Excel
If FileExist(sAddinFile)
   oXL = CreateObject("Excel.Application")
   If oXL == 0 Then Exit
   oXL.Visible = @FALSE ; change to @TRUE to run visable
   oXL.ScreenUpdating = @FALSE ; if running visable, change to @TRUE
   oXL.UserControl = @FALSE
   oXL.DisplayAlerts = @FALSE
   oXL.WorkBooks.Add()

   objAddins = oXL.AddIns()
   objAddin = ObjAddins.Add(sAddinFile)
   objAddin.Installed = @TRUE
   oXL.quit()
EndIf

Article ID:   W17147
File Created: 2007:07:03:14:28:30
Last Updated: 2007:07:03:14:28:30