Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Excel does not redraw iteself

I would like to test this on my PC. Can you zip the project and send it to
me. My email address is


/Fredrik

"Mircea Pleteriu" wrote in message
...
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






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pls confirm 2007 chart redraw is up to 10 times slower than 2003 larry godfrey Charts and Charting in Excel 27 September 6th 08 10:15 PM
Bug Report - chart redraw disintegrates - regression analysis outp Andyroo Charts and Charting in Excel 5 April 18th 08 12:56 AM
Redraw Application Window Kevin Excel Programming 2 September 27th 04 02:40 PM
How can you turn off screen Redraw Tom Ogilvy Excel Programming 0 June 3rd 04 09:05 PM
How can you turn off screen Redraw Masked Coder Excel Programming 0 June 3rd 04 08:53 PM


All times are GMT +1. The time now is 04:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"