Can't load add-in for XP Power User and Excel 2007.

N

nandan

I have an excel add-in that works under the following circumstances:

Works on XP Administrator and Excel 2003
Works on XP Power User and Excel 2003
Works on Vista and Excel 2007
Works with XP Administrator and Excel 2007.

But
Fails to load (no error messages) with XP Power User and Excel 2007.

Any ideas?

I am going to the 2007 equivalent of tools->Addins, browsing for my
addin and trying to add the add-in there.
Excel simply hangs.

I have XP with Office 2003 and 2007 on the same machine.
 
N

nandan

Hi Dennis,
Thanks for the reply..
Well from what the article said, it should work.
And it does work with Excel 2003 and my addin. (both admin and power
user)
And it does work with Excel 2007 and my addin (only admin)

I have no ideas why it would fail under power user....that's really
frustrating..

My addin, while loading, does write to the current users application
directory - its a hidden system directory under their documents and
settings....currently i see that it is not writing there; but that
should work...and does work in Excel 2003...but not in 2007...
 
X

XL-Dennis

Hi nandan,

It's difficult to track anything when we face a 'black box" situation...

What You may consider to use is SysInternals's free Process Monitor to track
down the issue
http://www.microsoft.com/technet/sysinternals/Processesandthreadsutilities.mspx

This is not a 'quick fix' but may give You a better knowledge of the issue.

---------------
With kind regards,
Dennis
Weekly Blog .NET & Excel: http://xldennis.wordpress.com/
My English site: http://www.excelkb.com/default.aspx
My Swedish site: http://www.xldennis.com/
 
N

nandan

Hi Dennis,
Thanks for your helpful suggestions so far..
Yeah i tried that (I used processexplorer as well as filemon.exe and
regmon.exe.) They seemed ok. Nothing egregious there...
But i did make progress.
Reinstalling the software in power user fixed it..so i looked into
what we were doing in our installer.

It turns out, that while installing the Add-in we add a registry key
called "OPEN" under Excel (HKCU "Software\Microsoft\Office
\officevesionhere\Excel\Options" "OPEN", that registers the add-in to
Excel.
The value of this key is the location of the add-in preceded by "/R"
I have no clue what that means..

For 2005 Power User, if i add this key manually things start working
again!!

If i browse to the Addin from within excel and then choose it, this
key should automatically be added, and does get added to 2005 when i
am in administrator , or to 2003 when i am in poweruser or admin, but
when i am in power user in 2005 it does not.

But i can add it manually, so i'm assuming Excel should be able to add
it...

I am looking into this some more to see what the heck is going on...
And why this key gets added sometime and not others...

Thanks for your help...
 
X

XL-Dennis

Hi nandan,

The "/R" switch indicates that the add-in is open in read mode. When You add
it manually under the Power user account the switch should not be there in
the registry.

I'm not sure but it looks like there are some limited administrative rights
under the Power User account.

---------------
With kind regards,
Dennis
Weekly Blog .NET & Excel: http://xldennis.wordpress.com/
My English site: http://www.excelkb.com/default.aspx
My Swedish site: http://www.xldennis.com/
 
N

nandan

Dennis,
Thanks for the info..

As part of install , we add the OPEN registry key, so when a user
launches the add-in , its already in their list.
On the same machine, when you move to PowerUser, obviously the keys
aren't there, since the key is under HKCU.
So , since the OPEN key is absent, the user has to manually add the
add-in.

When the user manually tries to add the add-in, once the add-in is
added successfully, the OPEN key is generated by Excel.
So i can add the add-in manually for 2003 and it adds it and
generates they key. In Admin mode, I can manually add the add-in, and
Excel will regenerate the OPEN key for both 2003 and 2007.

In Power User, for 2007 when i browse to the addin and choose it,
Excel hangs.
If I add the key before hand, then the add-in will load fine..

Adding the key, obviously is helping excel find and load what it is
looking for.

My addin has a C++ shim, and a .NET component, that is accessed by the
C++ shim using a COM interface.
When in power user, i use processExlporer to see what dlls are being
loaded. In 2005, the xll is loaded, but the .NET dll is not.
And i don't yet understand why...

Here is my xlAddinManager code..

LPXLOPER __declspec(dllexport) xlAddInManagerInfo(XlfOper pxAction)
{
static XLOPER xInfo;
int action = pxAction.AsInt();

// Set title if asked
if(action == 1) {
return (LPXLOPER)XlfOper("My Excel Add-In");
}
else {
return (LPXLOPER)XlfOper::Error(xlerrValue);
}
}

// nothing here...this should get called when the add-in is added by
the add-in manager..
BOOL __declspec(dllexport) xlAutoAdd(void)
{
// DEBUG
return TRUE;
}

// This should not get called when the add-in is added...
xll::xllTypeLib * typelib;
ICorRuntimeHost* m_pHost;
BOOL __declspec(dllexport) xlAutoOpen(void)
{
typelib = new
xll::xllTypeLib(XlfExcel::Instance().GetName().c_str());
typelib->registerModule();
Init(); //initializes the dotnet components...
return TRUE;
}

Its pretty straightforward, but then the My Excel Add-In entry is not
even generated before the add-in hangs..so i'm guessing this is some
kind of dll load issue..

Its weird that this only happens in 2007 and not in 2003....and not in
admin..
Its almost like Excel has a different load sequence for Admin and
PowerUser and that sequence changed from 2003 to 2007..
More digging ahead...
 
N

nandan

Dennis,
Thanks for the info..

As part of install , we add the OPEN registry key, so when a user
launches the add-in , its already in their list.
On the same machine, when you move to PowerUser, obviously the keys
aren't there, since the key is under HKCU.
So , since the OPEN key is absent, the user has to manually add the
add-in.

When the user manually tries to add the add-in, once the add-in is
added successfully, the OPEN key is generated by Excel.
So i can add the add-in manually for 2003 and it adds it and
generates they key. In Admin mode, I can manually add the add-in, and
Excel will regenerate the OPEN key for both 2003 and 2007.

In Power User, for 2007 when i browse to the addin and choose it,
Excel hangs.
If I add the key before hand, then the add-in will load fine..

Adding the key, obviously is helping excel find and load what it is
looking for.

My addin has a C++ shim, and a .NET component, that is accessed by the
C++ shim using a COM interface.
When in power user, i use processExlporer to see what dlls are being
loaded. In 2005, the xll is loaded, but the .NET dll is not.
And i don't yet understand why...

Here is my xlAddinManager code..

LPXLOPER __declspec(dllexport) xlAddInManagerInfo(XlfOper pxAction)
{
static XLOPER xInfo;
int action = pxAction.AsInt();

// Set title if asked
if(action == 1) {
return (LPXLOPER)XlfOper("My Excel Add-In");
}
else {
return (LPXLOPER)XlfOper::Error(xlerrValue);
}

}

// nothing here...this should get called when the add-in is added by
the add-in manager..
BOOL __declspec(dllexport) xlAutoAdd(void)
{
// DEBUG
return TRUE;
}

// This should not get called when the add-in is added...
xll::xllTypeLib * typelib;
ICorRuntimeHost* m_pHost;
BOOL __declspec(dllexport) xlAutoOpen(void)
{
typelib = new
xll::xllTypeLib(XlfExcel::Instance().GetName().c_str());
typelib->registerModule();
Init(); //initializes the dotnet components...
return TRUE;
}

Its pretty straightforward, but then the My Excel Add-In entry is not
even generated before the add-in hangs..so i'm guessing this is some
kind of dll load issue..

Its weird that this only happens in 2007 and not in 2003....and not in
admin..
Its almost like Excel has a different load sequence for Admin and
PowerUser and that sequence changed from 2003 to 2007..
More digging ahead...






- Show quoted text -

Phew..Finally figured this out.

This is another one of the numerous issues that i have found where
there are things that you should *NOT* do in .NET 1.1 that
unfortunately *DO* work(!@#!@), but then stop working when you move to
a newer version, typically a combination of .NET 2.0 and Office 2007.

In any case, the code was calling CoCreateInstance in the ExitInstance
of my app. As it so happens you should not call CoCreateInstance in
InitInstance or ExitInstance since these functions are called by
dllMain.

In .NET 1.1 and with .NET 2.0 with Office 2003 this works fine.
Consistently. I have never seen this fail in oh around 200 attempts.
However when I do this in Office 2007 the CoCreateInstance would
hang. !@!@#! Everytime.





In case this helps anyone, here is what happenned.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top