Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 SP1 will not repaint the entire spreadsheet. | Excel Discussion (Misc queries) | |||
Excel window repaint slow/stuck | Excel Discussion (Misc queries) | |||
Form Repaint Problem | Excel Discussion (Misc queries) | |||
Repaint causes form to flicker | Excel Programming | |||
How to force repaint of popup commandbar? | Excel Programming |