Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And wouldn't you want to avoid the possible error:
Option Explicit Public Sub InstallAddIn() Dim xlApp As Application 'As Object Dim xlAddIn As AddIn 'as Object Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True 'for testing xlApp.Workbooks.Add On Error Resume Next Set xlAddIn = xlApp.AddIns.Add("C:\XXX.xla", True) If Err.Number = 0 Then xlAddIn.Installed = True End If On Error GoTo 0 xlApp.Quit Set xlApp = Nothing End Sub If you're running this from excel, I'm not sure why you want to start a new excel application, though. But if you're running this from a VBS file (testing via excel???), then I broke your declarations. jean grey wrote: Hi, everyone. I need some help why the ff. code does not succeed: Public Sub InstallAddIn() Dim xlApp, xlAddIn Set xlApp = CreateObject ("Excel.Application") xlApp.Workbooks.Add xlAddIn = xlApp.AddIns.Add("C:\XXX.xla", True) If Err.Number = 0 Then xlAddIn.Installed = True End If xlApp.Quit Set xlApp = Nothing End Sub This installs the add-in in Excel 2003 but not in Excel 2000. It generates an error when calling xlAddIn = xlApp.AddIns.Add("C:\XXX.xla", True) I don't know how to modify the code using the suggested link below from other forums: http://support.microsoft.com/kb/213489/ Thanks in advance. -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA code runs in Excel 2003, fails in 2000 | Excel Programming | |||
Excel 2000 webquery fails for pages greater than 2k | Excel Programming | |||
Activate method of Worksheet class fails in Excel 2000 | Excel Discussion (Misc queries) | |||
Excel fails to open workbook using Automation from VB 6 | Excel Programming | |||
Excel 2000 Automation Error | Excel Programming |