ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   HELP: MsgBox takes 99% CPU usage... why? (https://www.excelbanter.com/excel-worksheet-functions/89840-help-msgbox-takes-99%25-cpu-usage-why.html)

Dhruba Bandopadhyay

HELP: MsgBox takes 99% CPU usage... why?
 
I got a problem with my Excel macro. It does some calculations then displays
a message box. However the message box is actually

displayed before the window maximize so what actually happens is the user
sees the minimised Excel blinking in the taskbar.

The problem is I have been told this blinking uses 50% of the CPU or almost
100% CPU usage. Is this normal? Is it waiting in a for

loop prompt?




Public Sub Updates_Off()
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With
End Sub

Public Sub Updates_On()
With Application
.StatusBar = False
.ScreenUpdating = True
.DisplayAlerts = True
.EnableEvents = True
.EnableCancelKey = xlInterrupt
.Cursor = xlDefault
.Calculation = xlCalculationAutomatic
End With
End Sub

Private Sub Workbook_Open()
Updates_Off
Application.WindowState = xlMinimized
Updates_On
Response = MsgBox("Test", vbYes + vbCritical, "Template Message")
Application.WindowState = xlMaximized
Application.Quit
End Sub





All times are GMT +1. The time now is 03:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com