View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Userform leaving a trail

Here is one way without any API.
It is not perfect, but is a starting point.

In the UserForm module:
---------------------------

Option Explicit
Private lTop As Long
Private lLeft As Long

Private Sub CommandButton1_Click()
RunLoop
End Sub

Private Sub UserForm_Layout()

If CLng(UserForm1.Top) < lTop Or _
CLng(UserForm1.Left) < lLeft Then
lTop = UserForm1.Top
lLeft = UserForm1.Left
Application.ScreenUpdating = True
Application.ScreenUpdating = False
End If

End Sub

In a normal module:
-----------------------

Option Explicit

Sub StartForm()

Application.ScreenUpdating = False

Load UserForm1
UserForm1.Show vbModal

End Sub

Sub RunLoop()

Dim i As Long

For i = 0 To 100000000
If i Mod 1000000 = 0 Then
DoEvents
End If
Next i

MsgBox "finished loop"

End Sub



RBS




"Brett" wrote in message
...
Thanks for your response. There's no chance that I can load it modeless on
a
few different fronts, and in enough sections it jumps around a few books
and
sheets so scr.upd is pretty much essential so...............how complex is
complex using the API? No time like the present (eh?). Brett.

"RB Smissaert" wrote:

Simplest is to set Application.ScreenUpdating = True and only set it to
False when it really is needed.
You could otherwise use the Windows API to solve this, but that will get
a
bit complex.

The other option is to show the form modeless:

Load UserForm1
UserForm1.Show vbModeless

but that may not suit your particular situation.

RBS


"Brett" wrote in message
...
I had some trouble with moving a userform around and using
screenupdating =
false because the userform left a trail behind. So, I change the code
to:
UF0_QCP.Hide: Sleep 200

where UF0_QCP is the userform. Now, it doesn't leave a trail, but the
UF
stays in the old spot with a completely white background whilst
simultaneously displaying properly in the new spot (better, but still
not
professional).

I'm sure that someone out there has a tachnique that they's love to
share
with me (please). Regards, Brett