BUG: Microsoft Excel Does Not Repaint Properly With AutomationID: Q187745
|
When automating Microsoft Excel 97 or Excel 2000, if the application window has been made visible and the user manually closes it, Excel will not repaint correctly the next time the application window is made visible again.
This problem occurs when a user attempts to quit a running instance of Excel while an Automation client still has a reference to the application object for that instance. By design, Excel does not quit an instance of itself unless all external references are released; if a user tries to quit Excel manually, the application window is merely hidden so that the Automation client may continue working. If, however, the Automation client attempts to make Excel visible again, the application window will not be displayed properly and repainting will not occur.
A workaround is to set the ScreenUpdating property of the application object to True after you have made the window visible. This will force Excel to repaint its client area so that it will be displayed properly.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
Private oApp As Excel.Application
Private Sub Command1_Click()
oApp.Visible = True
End Sub
Private Sub Form_Load()
Set oApp = CreateObject("Excel.Application")
Command1.Caption = "Show Excel"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set oApp = Nothing
End Sub
Private Sub Command1_Click()
oApp.Visible = True
oApp.ScreenUpdating = True
End Sub
Additional query words:
Keywords : kbinterop kbAutomation kbVBp kbGrpDSO kbOffice2000 kbExcel97 kbVBA500 kbexcel2000
Version : WINDOWS:2000,5.0,97; :
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: June 3, 1999