+ Reply to Thread
Results 1 to 6 of 6

How to temporarily hide a form?

  1. #1
    Registered User
    Join Date
    06-22-2007
    Posts
    7

    How to temporarily hide a form?

    How do I temporarily hide a form?

    I am unable to do Formname.Visible = True


    I know I can do Formname.hide but I don't want to run the initialize functions when I do Formname.show...

    help !!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Hi,
    try something like this
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-22-2007
    Posts
    7
    well that doesn't really help me. i only have 1 form in my project.
    i am having trouble with printpreview. i can't have a form and the print preview window open at the same time. so i am trying to hide the form while it's on the print preview screen and then put it back when print preview is closed.


    any thoughts?

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    From what I understand....
    When you hide the userform, the userform is just hidden, not unloaded...
    so when you show the userform again, it should not initialize because it was just hidden, what are we missing here??

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Msangapu,

    To solve the problem you need to do 2 things. Set the UserForm Modal property to False and be able to minimize and restore the Form like a Window. This set of macros allows you to add the minimize and restore buttons to the Title Bar, and add an icon from a file. The code is long (typical for API calls), but the macros are easy to use.

    Please Login or Register  to view this content.
    To Install the Macro:
    1. Copy the Macro code above using CTRL+C
    2. Open Excel and Right Click on any Sheet Tab
    3. Click on View Code in the pop up menu
    4. Use ALT+I to activate the VBE Insert Menu
    5. Press the letter m to insert a Standard Module
    6. Paste the macro code using CTRL+V
    7. Save the macro using CTRL+S
    8. Close the VBE and return to excel using ALT+Q

    Calling the Macros:
    Change the name of the UserForm to match your Form's name.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  6. #6
    Registered User
    Join Date
    06-22-2007
    Posts
    7

    .Show is clearing some variables

    Quote Originally Posted by davesexcel
    From what I understand....
    When you hide the userform, the userform is just hidden, not unloaded...
    so when you show the userform again, it should not initialize because it was just hidden, what are we missing here??
    Are you sure about that? It would make sense that it did work that way, but from my experience, it was affecting several variables. When I ran the print_preview, I did the formname.hide and after print_preview was done, I did formname.show.... but when if I clicked on the print_preview again, it comes up blank...

    So I figured .hide and .show were doing something funky.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1