Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Smotth Form.Hide Form.Show

Status
Not open for further replies.

krinid

Programmer
Jun 10, 2003
356
CA
I'm trying to hide a UserForm in Excel and display a small userform in it's place that when the smaller form is clicked, the small form disappears and the original form reappears in its original place. The idea is basically to hide (or minimize) the large form so the user can more easily access the worksheet behind the form, and then bring the form back as desired.

I've got the basic workings of complete with one small dissatisfaction. The Form.top and Form.left properties and reset to 0 after Form.show and the window appears in the top left corner! I've implemented a way to store the original coordinates before doing a Form.hide and then restoring them after the Form.show but the form still appears in the wrong spot for a split second before moving to the correct spot and looks unprofessional. The top/left coordinate change can't be done after Form.hide and before Form.show because the properties can't be accessed.

I'm not set on doing this using Form.hide/show and swapping the coordinates, so if anyone has a better idea, I'm all ears.

Summary of problems:
- cannot change the Form.Visible property (read-only)
- when Form.hide is done, the Form.top and Form.left properties are inaccessible
- after Form.show is done, Form.top and Form.left are reset back to 0
 
Hi krinid,

I'm not entirely sure about this and I haven't mocked up your situation to test it, but I think that setting Application.ScreenUpdating = False before Showing your form and setting it True again after setting your co-ordinates should, in theory, stop the flash of the form in the wrong place. Of course, as I saw in a byline on someone else's post, in theory there is no difference betwen theory and practice, in practice there is.

Enjoy,
Tony
 
Tony,
Thanks for the tip. I tried it, but it doesn't seem to work for forms. I verified that works for hiding data and even MsgBox's, but forms still appear and disappear regularly when .Hide or .Show is invoked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top