.Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns
.Net Office and old AddIns .Net Office and old AddIns
.Net Office and old AddIns
Go Back  Xtreme Visual Basic Talk > > > .Net Office and old AddIns


Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2005, 03:44 PM
rdarnold rdarnold is offline
Newcomer
 
Join Date: Apr 2005
Posts: 2
Default .Net Office and old AddIns


I've written several Excel sheets using the .Net automation. They generally work like a charm. However, if I have some addins loaded, then sometimes the automation can not find buttons on the Excel sheet. ( not sure if it messes up other code or if it is just MSForms)

If I unload these addins then it works fine (but I need them for their functionality in this application). I can even load the addins after the workbook is open and everything works fine. The content of these addins are Excel cell functions that make external calls to .dll files.

I suppose I could write code to unload the addins and then reload them after the sheet is open. However I'm worried that this indicates a deeper problem.

Any ideas? I'm a novice so any help is appreciated (first time posting to any faq too).

thx
Reply With Quote
  #2  
Old 04-15-2005, 04:17 PM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi Darnold,

Welcome to the forum.

I honestly don't see how the presence of an Addin can block your ability to find certain buttons on the Worksheet. (Unless the Addin is actually removing said buttons?)

I really don't know how this is possible. It sounds like a sort of quirky issue we sometime see. A graphic affect sometimes (a.k.a., the "Laura Effect") or a control alignment problem (a.k.a.the "Mill Effect"). These are effectively MSFT bugs of sorts and can usually, but not always, be gotten around.

Unloading an Addin though is not a simple solution. Firstly, are these Addins XLA Addins, or are they Automation Addins? Either way, I'm pretty sure that setting Addin.Installed = False does not *really* uninstall it. It will generally remain active until the next Excel session. You can test this, but I think that your Automation routine would have to (1) Open Excel, (2) Uninstall the Addin, (3) Close Excel, (4) Re-Open Excel and now you should be able to do what you want. When done, you would (5) re-intall the Addin. A fair amount of work, to be sure, but if what you describe is accurate, then it has a shot at correcting your problem.

Beyond these generalities, you might provide a little more detail on what code you are using and where it fails and with what error message? However, unless we see something wrong in your code, it does sound like a MSFT bug or possible corruption of some sort...
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #3  
Old 04-16-2005, 05:30 PM
rdarnold rdarnold is offline
Newcomer
 
Join Date: Apr 2005
Posts: 2
Default

Thanks Mike,

I'll provide some more details but it must be some quirky thing (especially since it does not always happen). At least knowing it is not obvious will prevent me from wasting time on it.

I'm actually operating in Server 2003 (not sure why?) and Office 2003. That may be the source of the bug. There are several addins that cause the problem but none of them are professionally written. They are basically just VBA wrappers for external function calls and certainly don't affect the buttons on the excel sheets.

I've included the code snippet. I did it in C# but have the same problem in VB. The error message that I get is just the "Couldn't find NG Fetch Forward Curve Button" that I have as the message if it can't FindControl. Nothing fancy.
Code:
 protected void ThisWorkbook_Open()
        {
    
	this.FFC_NGWorksheet = 
		ExcelHelpers.GetWorksheet(this.ThisWorkbook,"Natty");
			

	// find FFC button
	this.FFC_NGButton = (MSForms.CommandButton)this.FindControl(
		"FFCbutton_NG",this.FFC_NGWorksheet);
	if (this.FFC_NGButton != null )
	{
		this.FFC_NGButton.Click += new
			MSForms.CommandButtonEvents_ClickEventHandler(
			FFC_NGButton_Click);
	}
	else
	{
		MessageBox.Show("Couldn't find NG Fetch Forward Curve Button");
	}

...
Again, thanks for the time. I may get a new machine and will use XP. I'll let you know if that is indeed the problem.

Last edited by herilane; 04-17-2005 at 07:54 AM. Reason: added [code] tags
Reply With Quote
  #4  
Old 04-17-2005, 07:56 AM
herilane's Avatar
herilane.Net Office and old AddIns herilane is offline
Unashamed geek

Retired Moderator
* Expert *
 
Join Date: Jul 2003
Location: London, England
Posts: 8,988
Default

What does the FindControl function look like? I assume this is a function that you've written, not the built-in Office.Commanbars.FindControl function?
Reply With Quote
  #5  
Old 04-17-2005, 09:04 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Yes, and what is 'this' exactly, what kind of class? I'm assuming it's your own custom class and so this.FindControl() is your own function? Or is 'this' class inheriting from a third-party Class and so .FindControl() is neither MSFT's no your own?

Also, is your project a .Net EXE, or are you using Visual Studio Tools? If so, is it VSTools 2003, or the 2005 Beta?

But, bottom line, you're saying that the following:
Code:
this.FindControl("FFCbutton_NG",this.FFC_NGWorksheet);
Sometimes works and sometimes does not?

If so I think it's going to be tough to fix...
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
.Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns .Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns .Net Office and old AddIns
.Net Office and old AddIns
.Net Office and old AddIns
 
.Net Office and old AddIns
.Net Office and old AddIns
 
-->