473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

excel ribbon becoming unresponsive

Bob
Hi,
I am trying to create an add-in for Excel using Visual Studio Tools
for Office. I have added some buttons to ribbon. Upon clicking one,
I launch another application that interacts with excel. But for some
reason after doing that the Excel sheet is no longer responsive to
clicks of the button ribbons. Anyone have any ideas of what could be
wrong?

Thanks,
Bob
Sep 29 '08 #1
4 2516
It is just a wild guess since I haven't done anything with add-in's so
far. Could it be that that your button starts this other process and
waits for its completion? If so then my guess is that the thread that
your button is in may be still waiting for the other process to finish
hence the blocking UI. Maybe you could try to start the other process
in a separate thread to get around this, but maybe this also makes
things too complicated.

Greets
Frank
Sep 30 '08 #2
Bob
On Sep 30, 3:37*am, Frank Munsberg <bufferunder...@gmx.dewrote:
It is just a wild guess since I haven't done anything with add-in's so
far. Could it be that that your button starts this other process and
waits for its completion? If so then my guess is that the thread that
your button is in may be still waiting for the other process to finish
hence the blocking UI. Maybe you could try to start the other process
in a separate thread to get around this, but maybe this also makes
things too complicated.

Greets
Frank

I think that might be it but when I try to use a ThreadStart to start
in a different thread the application I am trying to run seems to
crash. Is this the right way to do it:
Launcher useForLaunch = new Launcher();

useForLaunch.excelObj = excelObj;

System.Threading.Thread oThread = new System.Threading.Thread(new
System.Threading.ThreadStart(useForLaunch.Launch)) ;
oThread.Start();

public class Launcher{

internal Microsoft.Office.Interop.Excel.Application
excelObj;
internal void Launch()
{

ExternalInterface fInt2 = new ExternalInterface(excelObj);
}
}

Thanks!
Bob
Sep 30 '08 #3
Hmm, I have only used the "BackgroundWorker" classes present
since .Net 2.0.
The documentation has some pretty good example how to set them up but
basically its like creating a BackgroundWorker object, writing at
least one eventhandler for the DoWork event and one for the
RunWorkerCompleted event. Any Exception inside the background thread
will end the thread and you end up inside the RunWorkerCompleted
handler.
In your case this would look like
BackgroundWorker imyworker = new BackgroundWorker();
// then add the event handlers to the DoWork and RunWorkerCompleted
events and finally call imyworker.RunWorkerAsync() and off it goes.

void imyworker_DoWork(object sender, DoWorkEventArgs e)
{
//maybe some other init stuff here
useForLauncher.Launch();
}
void imyworker_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
{
if (e.Error != null) // an exception occurred, e.Error contains the
exception object
//maybe some other cleanup code, message, log entry etc.
}

Maybe the exception that you get tells you what's going wrong

Greets
Frank
Oct 1 '08 #4
Bob
On Oct 1, 2:25*am, Frank Munsberg <bufferunder...@gmx.dewrote:
Hmm, I have only used the "BackgroundWorker" classes present
since .Net 2.0.
The documentation has some pretty good example how to set them up but
basically its like creating a BackgroundWorker object, writing at
least one eventhandler for the DoWork event and one for the
RunWorkerCompleted event. Any Exception inside the background thread
will end the thread and you end up inside the RunWorkerCompleted
handler.

In your case this would look like
BackgroundWorker imyworker = new BackgroundWorker();
// then add the event handlers to the DoWork and RunWorkerCompleted
events and finally call imyworker.RunWorkerAsync() and off it goes.

* * * * void imyworker_DoWork(object sender, DoWorkEventArgs e)
* * * * {
* * * * * * * * //maybe some other init stuff here
* * * * * * * * useForLauncher.Launch();
* * * * }
* * * * void imyworker_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
* * * * {
* * * * * * * * if (e.Error != null) *// an exceptionoccurred, e.Error contains the
exception object
* * * * * * * * //maybe some other cleanup code, message,log entry etc.
* * * * }

Maybe the exception that you get tells you what's going wrong

Greets
Frank
Thanks for the very thoughtful post. I don't think a background
worker will work because the process I want to start is itself a a
gui. Not getting an exception in the c#, the excel instance crashes.
Oct 2 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Geert-Pieter Hof | last post by:
Hello, My VB 6.0 application read and writes data from and to a MS Excel workbook, using the Microsoft.Jet.OLEDB.4.0 provider. Now I want to protect the Excel workbook with a password, but I...
10
by: Mark Day | last post by:
Hi All, I am using Access 2000 to generate over 40 Excel charts and pivot tables using early binding to the Excel 9.0 object library. I am finding that if I show the Excel object while processing...
0
by: Bas | last post by:
My app does some processing Excel using Interop When this happens my FORM which launched the Excel process is UNRESPONSIVE like its hung if I change window to do anything else the form breaks up...
7
by: denuk2003 | last post by:
Hi Everybody I have a 2003 application that I am trying to run under 2007, The code seems to work OK but the Ribbon is a big problem. It just takes up too much space away from the application. ...
0
by: Bertha94 | last post by:
I am trying to figure out how to minimize the ribbon when the program starts up. From what i've read, the only way Excel can recognize is by the height of the command bar. I have a rough sketch of...
0
by: ARC | last post by:
Well, maybe not interesting, more like hair-pulling. Ok, so if you want to code misc. utilities and forms for the office button (Like a registration screen, backup, setup options, connect to...
4
by: scubasteve | last post by:
Hi, I'm having issues with AC2007 custom ribbons. I'm building an AC2007 runtime app which has a custom ribbon (called CommandsDisabledHideRibbon) set as the default db ribbon name (see XML at...
21
by: Cele Balser | last post by:
Can someone tell me the VBA code to use in my module to select the External Data ribbon? I have a module that runs through some queries and at the end of them I want to export the query to Excel. I...
0
by: Lyu KingT | last post by:
hi, i need to control the right of a Office document in my Visual Studio Projects, so how to enable or disable the print, what abou edit, save..... i try to fellow the video How Do I: Hi-jack...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.