Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Userform leaving a trail

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Userform leaving a trail

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Userform leaving a trail

Hi,

You'll encounter this with screen updating set to false. Set updatting to
true.

Mike

"Brett" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Userform leaving a trail

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Userform leaving a trail

Hi again Mike, no chance I'm afraid - it's a case of stop it or you'll go
blind. I'm interested to see what RBS has to say about using the API. Brett

"Mike H" wrote:

Hi,

You'll encounter this with screen updating set to false. Set updatting to
true.

Mike

"Brett" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Userform leaving a trail

Put

DoEvents

in your code so that it happens at least every three seconds. It means "take
a short break and listen to the operating system". Allowing windows to
reposition, your orders to interrupt the running code, occational emails to
be delivered, ... Yes it slows down the code, but makes it far less annoying
as a user experience.

HTH. Best wishes Harald


"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


  #7   Report Post  
Posted to microsoft.public.excel.programming
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




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Userform leaving a trail

Hi Harald, thank you for that. A quick question (with time zones in mind -
I'm in Oz) before I try some fooling around with that: Should the DoEvents go
just before or just after I'm hiding the UF? How do I get DoEvents to fire
every 3 (or whatever) seconds?

"Harald Staff" wrote:

Put

DoEvents

in your code so that it happens at least every three seconds. It means "take
a short break and listen to the operating system". Allowing windows to
reposition, your orders to interrupt the running code, occational emails to
be delivered, ... Yes it slows down the code, but makes it far less annoying
as a user experience.

HTH. Best wishes Harald


"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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audit Trail Rich[_8_] Excel Discussion (Misc queries) 4 April 10th 10 08:57 PM
Userform - On movement leaves a trail. Matts Excel Programming 2 October 21st 08 02:50 PM
audit trail MIke Excel Discussion (Misc queries) 4 February 27th 08 12:11 AM
help!? trail report Duncan[_5_] Excel Programming 5 April 11th 06 10:58 AM
Audit Trail Pendelfin Excel Discussion (Misc queries) 1 January 23rd 06 03:04 PM


All times are GMT +1. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"