Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cannot load Excel 2000 Addin from Word (and that's so weird!)
Hi all,
i create a new Workbook programmatically from a Word Macro. This Workbook must have a Addin loaded when it get created. So, what i want to do is to load the Addin before creating the Workbook. This is the my code, in Word: Dim excelApp As Object Dim templatePathVariant As Variant Dim lotusOfficeAddIn As Object Dim lotusOfficeAddInFilePath As String Set excelApp = CreateObject("Excel.Application") templatePathVariant = templatePath Set newDocument = excelApp.WorkBooks.Add(Template:=templatePath) lotusOfficeAddInFilePath = Environ$("appdata") & "\Microsoft\Excel\XLSTART\LotusOffice.xla" Set lotusOfficeAddIn = excelApp.AddIns.Add(lotusOfficeAddInFilePath, True) excelApp.AddIns(lotusOfficeAddIn.Title).Installed = True excelApp.Visible = True The code seems to work fine. The Workbook get created. What is strange, it's that now, from the Workbook in Excel, i can't access to the Addin, although the Addin results installed in Excel (checked through its "Installed" property). This is the code: Private Sub Workbook_Open() Application.Run ("LotusOffice.xla!LotusOffice_onOpen") End Sub What i get is a Runtime error 1004: 'LotusOffice.xla' could not be found. Check the spelling of the file name, and verify that the file location is correct. But as i said, the addin with Title "LotusOffice.xla" appears installed. Now the weird behaviour. If i add the addin path to call it, i mean with Application.Run (Environ$("appdata") & "\Microsoft\Excel\XLSTART\" & "LotusOffice.xla!LotusOffice_onOpen") it says that Excel cannot find the macro "LotusOffice_onOpen" (it's declared Public, in LotusOffice.xla) But if then i call again (in the same debug session) the line Application.Run ("LotusOffice.xla!LotusOffice_onOpen") then Excel finds the macro correctly!! What is that?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | Excel Discussion (Misc queries) | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | New Users to Excel | |||
Weird AddIn behaviour | Excel Programming | |||
why templates do not load into excel 2000? | Excel Discussion (Misc queries) | |||
Load xla addin on demand for particular Excel instances | Excel Programming |