Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Hi,
I'm developing a class which opens the MS Excel and extend the context menu with a new item. When the item is clicked all it does is to popup a message box. While the message box is displayed, it seems that Excel is locked up and not redrawing its surface until message box control returns to it, that is, until the message box is acknowledged. I mention that my class is not a macro. It just accesses the Excel from within an .NET Windows Application. Any idea why MS Excel framwork does not get repaint while the message box is shown? Thanks, Mircea |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
"Mircea Pleteriu" wrote in message ... Hi, I'm developing a class which opens the MS Excel and extend the context menu with a new item. When the item is clicked all it does is to popup a message box. While the message box is displayed, it seems that Excel is locked up and not redrawing its surface until message box control returns to it, that is, until the message box is acknowledged. I mention that my class is not a macro. It just accesses the Excel from within an .NET Windows Application. Any idea why MS Excel framwork does not get repaint while the message box is shown? Thanks, Mircea What happens if you drag the messagebox around? Will it be all white? /Fredrik |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Not at all. The Excel does not repaint and an image with the message box at
the previous position remains on the screen. "Fredrik Wahlgren" wrote in message ... "Mircea Pleteriu" wrote in message ... Hi, I'm developing a class which opens the MS Excel and extend the context menu with a new item. When the item is clicked all it does is to popup a message box. While the message box is displayed, it seems that Excel is locked up and not redrawing its surface until message box control returns to it, that is, until the message box is acknowledged. I mention that my class is not a macro. It just accesses the Excel from within an .NET Windows Application. Any idea why MS Excel framwork does not get repaint while the message box is shown? Thanks, Mircea What happens if you drag the messagebox around? Will it be all white? /Fredrik |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
"Mircea Pleteriu" wrote in message ... Not at all. The Excel does not repaint and an image with the message box at the previous position remains on the screen. So you end up with 2 or more messageboxes? Can you attach a screen copy. I know I had a problem like this a long time ago, I hope I can remeber the solution. /Fredrik |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
"Mircea Pleteriu" wrote in message ... Please find attached a screen shot. I recognize this problem. I need to think before I can reply. BTW since your code apparently is very small, can you send it as well. All I want is the minimum amount of code that shows this problem. /Fredrik |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Here it is:
// Create instance of Excel application this.excelApp = new Excel.ApplicationClass(); this.workbooks = this.excelApp.Workbooks; // Open workbook with file this.fileWorkbook = workbooks.Open(path, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); // Get context menu Office.CommandBarControls contextMenu = this.excelApp.CommandBars["Cell"].Controls; // Add item to menu this.item = (Office.CommandBarButton)contextMenu.Add(Office.Ms oControlType.msoControlBut ton, Type.Missing, Type.Missing, Type.Missing, true); this.item.Caption = "MyNewItem"; this.item.BeginGroup = true; this.item.Click += new Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(ClickHandler Method); // Make instance of Excel application visible this.excelApp.Visible = true; Here is the ClickHandlerMethod's code // Switch alerts off this.excelApp.DisplayAlerts = false; System.Windows.Forms.MessageBox.Show("Excel does not repaint!"); "Fredrik Wahlgren" wrote in message ... "Mircea Pleteriu" wrote in message ... Please find attached a screen shot. I recognize this problem. I need to think before I can reply. BTW since your code apparently is very small, can you send it as well. All I want is the minimum amount of code that shows this problem. /Fredrik |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
|
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Hi Mircea,
Try setting the ScreenUpdating property of the Excel Application object to True before displaying any forms or messageboxes. I'm not sure why it would be False, as it defaults to True. But explicitly setting it to True should fix what you're seeing. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Mircea Pleteriu wrote: Hi, I'm developing a class which opens the MS Excel and extend the context menu with a new item. When the item is clicked all it does is to popup a message box. While the message box is displayed, it seems that Excel is locked up and not redrawing its surface until message box control returns to it, that is, until the message box is acknowledged. I mention that my class is not a macro. It just accesses the Excel from within an .NET Windows Application. Any idea why MS Excel framwork does not get repaint while the message box is shown? Thanks, Mircea |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
"Jake Marx" wrote in message ... Hi Mircea, Try setting the ScreenUpdating property of the Excel Application object to True before displaying any forms or messageboxes. I'm not sure why it would be False, as it defaults to True. But explicitly setting it to True should fix what you're seeing. -- Regards, Jake Marx MS MVP - Excel www.longhead.com I.m not sure it will help but it's worth trying. I did a test where I set this property to false. I then dragged other windows over Excel, both from Excel and from other programs. Excel redraw as it should. I don't think this command prevents Excel's main window from being redrawn although it prevents updated values in cells to appear. /Fredrik |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Hi Mircea,
The picture you attached, together with the other symptoms you described, is typical of Screenupdating not being reset from False to True, I'm assuming that somewhere you disabled it. Application.ScreenUpdating = True Always ensure it is reset when your code terminates, sometimes gets overlooked in error handling routines. Also need to reset to display a MsgBox, or indeed any thing else that changes that you want your users to see while your code is running. Regards, Peter T "Mircea Pleteriu" wrote in message ... Please find attached a screen shot. "Fredrik Wahlgren" wrote in message ... "Mircea Pleteriu" wrote in message ... Not at all. The Excel does not repaint and an image with the message box at the previous position remains on the screen. So you end up with 2 or more messageboxes? Can you attach a screen copy. I know I had a problem like this a long time ago, I hope I can remeber the solution. /Fredrik |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
I've set the ScreenUptating to true but no change. The same behaviour.
"Peter T" <peter_t@discussions wrote in message ... Hi Mircea, The picture you attached, together with the other symptoms you described, is typical of Screenupdating not being reset from False to True, I'm assuming that somewhere you disabled it. Application.ScreenUpdating = True Always ensure it is reset when your code terminates, sometimes gets overlooked in error handling routines. Also need to reset to display a MsgBox, or indeed any thing else that changes that you want your users to see while your code is running. Regards, Peter T "Mircea Pleteriu" wrote in message ... Please find attached a screen shot. "Fredrik Wahlgren" wrote in message ... "Mircea Pleteriu" wrote in message ... Not at all. The Excel does not repaint and an image with the message box at the previous position remains on the screen. So you end up with 2 or more messageboxes? Can you attach a screen copy. I know I had a problem like this a long time ago, I hope I can remeber the solution. /Fredrik |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Still not working. I coded in C#. Could it be a problem?
"Fredrik Wahlgren" wrote in message ... "Jake Marx" wrote in message ... Hi Mircea, Try setting the ScreenUpdating property of the Excel Application object to True before displaying any forms or messageboxes. I'm not sure why it would be False, as it defaults to True. But explicitly setting it to True should fix what you're seeing. -- Regards, Jake Marx MS MVP - Excel www.longhead.com I.m not sure it will help but it's worth trying. I did a test where I set this property to false. I then dragged other windows over Excel, both from Excel and from other programs. Excel redraw as it should. I don't think this command prevents Excel's main window from being redrawn although it prevents updated values in cells to appear. /Fredrik |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Do I have to set the parent of the message box to point to the Excel's main
window? "Fredrik Wahlgren" wrote in message ... "Jake Marx" wrote in message ... Hi Mircea, Try setting the ScreenUpdating property of the Excel Application object to True before displaying any forms or messageboxes. I'm not sure why it would be False, as it defaults to True. But explicitly setting it to True should fix what you're seeing. -- Regards, Jake Marx MS MVP - Excel www.longhead.com I.m not sure it will help but it's worth trying. I did a test where I set this property to false. I then dragged other windows over Excel, both from Excel and from other programs. Excel redraw as it should. I don't think this command prevents Excel's main window from being redrawn although it prevents updated values in cells to appear. /Fredrik |
#14
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel does not redraw iteself
Hi Mircea,
Attaching files to this NG is frowned upon. I'm not much of a C# expert, but I tried creating a simple C# winforms app that does what you're doing, and I was unable to get Excel to refresh its display, too. I tried passing Excel's handle to the Show method of the MessageBox class, and it didn't help. You may want to try your question in a C# group to see if anyone has had this problem when automating Excel from C#. Sorry! -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Mircea Pleteriu wrote: Hi Jake, Please find attached the solution with my very short windows app. Maybe you'll get an idea about what's going wrong. The code is very simple. Thank you for any help, Mircea "Jake Marx" wrote in message ... Hi Mircea, Try setting the ScreenUpdating property of the Excel Application object to True before displaying any forms or messageboxes. I'm not sure why it would be False, as it defaults to True. But explicitly setting it to True should fix what you're seeing. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Mircea Pleteriu wrote: Hi, I'm developing a class which opens the MS Excel and extend the context menu with a new item. When the item is clicked all it does is to popup a message box. While the message box is displayed, it seems that Excel is locked up and not redrawing its surface until message box control returns to it, that is, until the message box is acknowledged. I mention that my class is not a macro. It just accesses the Excel from within an .NET Windows Application. Any idea why MS Excel framwork does not get repaint while the message box is shown? Thanks, Mircea |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pls confirm 2007 chart redraw is up to 10 times slower than 2003 | Charts and Charting in Excel | |||
Bug Report - chart redraw disintegrates - regression analysis outp | Charts and Charting in Excel | |||
Redraw Application Window | Excel Programming | |||
How can you turn off screen Redraw | Excel Programming | |||
How can you turn off screen Redraw | Excel Programming |