Task Bar & Windows Title changes

O

Otto Moehrbach

Excel 2002, WinXP
I have some code that opens another file, checks it for various criteria,
and closes that file. I have that code bracketed with the ScreenUpdating
False/True statements.
All this works just fine, except that the task bar at the bottom of the
screen jumps during this process of opening/closing of this other file.
Is there a way to "freeze" or otherwise prevent the task bar from
jumping during this section of my code?
My user says that the title bar at the top of the Excel window also
jumps, so the same question applies to that. Thanks for your help. Otto
 
V

Vasant Nanavati

Hi Otto:

Try this at your own risk:

Private Declare Function LockWindowUpdate Lib "USER32" _
(ByVal hwndLock As Long) As Long
Private Declare Function GetDesktopWindow Lib "USER32" () As Long

Sub WindowUpdating(Enabled As Boolean)
'Completely Locks the Whole Application Screen Area,
'including dialogs and the mouse.
Dim Res As Long
If Enabled Then
LockWindowUpdate 0
'Unlock screen area
Else
Res = LockWindowUpdate(GetDesktopWindow)
'Lock at desktop level
End If
End Sub

Sub Test()
WindowUpdating False
Application.Wait Now + TimeValue("00:00:05")
WindowUpdating True
End Sub

(Stolen from Dave Peterson, who might have stolen it from Laurent Longre
:)).

Regards,

Vasant
 
O

Otto Moehrbach

Vasant
Thanks for that and thanks for the warning. I'll pass it on to my user,
warning and all. Otto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top