+ Reply to Thread
Results 1 to 12 of 12

close/minimise form control

  1. #1
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    close/minimise form control

    Hi

    I have a button that opens a user form, the form has the ability to be minimised to the task bar. I would like to get the button to either restore the form the task bar or open a new form if it isn't open all ready. currently the button will open a new form and this will confuse the end user if they have one open already but minimised to the task bar!

    Can anyone help?

    The form name is ControlPanel

    many thanks.

    nods
    Last edited by nods; 11-11-2010 at 12:41 AM.

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

    Re: close/minimise form control

    Hello nods,

    You should post your workbook. We can then see the code you are using and the layout of your project. The Devil is in the details.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: close/minimise form control

    I have tried uploading it a few times and I keep getting a database error message.

    It is a 3.5meg zip file.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: close/minimise form control

    What kind of userform allows minimization? In 2007, I couldn't find a way to minimize a userform.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: close/minimise form control

    If you paste this code into the form it should add a minimize button.

    (this was taken from an example posted on this site)




    Please Login or Register  to view this content.

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

    Re: close/minimise form control

    Hello nods,

    That is crazy. Here is module to allow you to place the minimize, and restore buttons onto your UserForm. NOTE: Set the UserForm ShowModal property to False.
    Please Login or Register  to view this content.

    How to Call the Macro
    Please Login or Register  to view this content.


    EDIT: Changed UserForm Event from Initialize to Activate.
    Last edited by Leith Ross; 11-06-2010 at 03:08 AM.

  7. #7
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: close/minimise form control

    Thanks leith that worked a treat, wish I had the code earlier.

    But back to my original problem

    what i want to achieve when the button is pressed but I keep getting a syntax error.

    If the form is minimized then restore else open a new form.

    code I have so far



    Please Login or Register  to view this content.
    frm.Show
    End Sub

    do you have any ideas?

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

    Re: close/minimise form control

    Hello nods,

    If you want to minimize and restore the UserForm from a button on the worksheet then this makes it easier. Remove the previous code module and use this code.
    Please Login or Register  to view this content.

    UserForm Code Neeeded
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: close/minimise form control

    Thanks Leith That solved the problem.

  10. #10
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: close/minimise form control

    Hi leith

    I was using Excel 2010 when I cread the module for the Min/Max controls using the code you gave me in this thread and it worked fine. I just checked in 2007 and the min button closes the form and in 2003 the controls dont show at all unless I open the form from the VBA editor.

    Any Ideas on what the problem could be or how to solve it? The majority of the people using the work book will be uisng excel 2003.

    Many thanks

    Code below.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

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

    Re: close/minimise form control

    Hello nods,

    I can't say what the cause of the problem is. I originally wrote the code using Excel 2000 on Windows 2000. It has run fine on my Windows 2003 XP machine with no problems since then.

  12. #12
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: close/minimise form control

    Thanks Leith.

    I have had a few compatibilty problems when doing stuff in excell 2010.

    Back to 2003 me thinks.

+ 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