Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] Excel Discussion (Misc queries) 2 September 10th 08 11:07 AM
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] New Users to Excel 2 September 10th 08 11:07 AM
Weird AddIn behaviour Trefor Excel Programming 18 September 15th 06 12:10 PM
why templates do not load into excel 2000? Ron Excel Discussion (Misc queries) 2 December 23rd 04 06:31 PM
Load xla addin on demand for particular Excel instances DKG Excel Programming 1 June 9th 04 04:09 PM


All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"