PC Review


Reply
Thread Tools Rate Thread

Cannot load Excel 2000 Addin from Word (and that's so weird!)

 
 
Montezuma
Guest
Posts: n/a
 
      18th Jan 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook from office 2000 will not load, excel & word are ok sandralee Microsoft Outlook Discussion 2 6th Aug 2008 09:09 PM
Not able to load excel addin shantanu Microsoft Excel Programming 3 28th Mar 2007 06:00 AM
Excel 2000 Solver AddIn: Model Load & Reset Have Excessive Delay =?Utf-8?B?RGF2aWQgU21pdGg=?= Microsoft Excel Programming 2 11th Mar 2004 12:31 PM
Excel 2000 Solver AddIn: Model Load & Reset Have Excessive Delay =?Utf-8?B?RGF2aWQgU21pdGg=?= Microsoft Excel Worksheet Functions 2 11th Mar 2004 12:31 PM
howtofix excel 2000 says invalid AddIn for valid excel97 AddIn robm Microsoft Excel Discussion 0 24th Sep 2003 06:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:29 PM.