Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel does not repaint

Excel Application does not repaint itself when automated
from VB.NET using the following code.
1. Open New Windows Application Project in VB.Net 2003.
2. Add COM Reference to Microsoft Excel 10 Library.
3. Add Form1 to the project.
4. Add Form2 to the project.
5. Add Button control to Form1.
6. Insert the following code in Form1:

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
xl = New
Microsoft.Office.Interop.Excel.ApplicationClass

' Create a command bar
Dim toolBar As Microsoft.Office.Core.CommandBar =
Nothing
toolBar = CType(xl.CommandBars.Add("NLC CASA
Toolbar",
Microsoft.Office.Core.MsoBarPosition.msoBarTop, , True),
Microsoft.Office.Core.CommandBar)
toolBar.Visible = True

'create new button
newButton = CType(toolBar.Controls.Add
(Microsoft.Office.Core.MsoControlType.msoControlBu tton),
Microsoft.Office.Core.CommandBarButton)
newButton.Caption = "Insert Input Element"
newButton.FaceId = 88
'AddHandler newButton.Click, AddressOf
ShowCustomForm

wkb = xl.Workbooks.Add
xl.EnableEvents = True
xl.Visible = True

End Sub

Private Sub newButton_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef
CancelDefault As Boolean) Handles newButton.Click
Dim frm As New Form2
frm.TopMost = True
frm.ShowDialog()
End Sub

7. When Application runs press button (Excel will be open).
8. In Excel press newly created button, which shows 'I' in
it (Form2 opens on top).
9. If you move Form2 Excel does not repaint itself.

I even tried using Windows API. It does not help...
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
Excel 2007 SP1 will not repaint the entire spreadsheet. Dan D. Excel Discussion (Misc queries) 3 November 25th 08 01:43 AM
Excel window repaint slow/stuck hmm Excel Discussion (Misc queries) 1 August 13th 08 02:44 PM
Form Repaint Problem ybazizi Excel Discussion (Misc queries) 0 January 18th 06 05:32 PM
Repaint causes form to flicker Chad Excel Programming 2 April 28th 04 01:01 AM
How to force repaint of popup commandbar? RB Smissaert Excel Programming 0 December 17th 03 01:59 PM


All times are GMT +1. The time now is 12:04 PM.

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

About Us

"It's about Microsoft Excel"