Hide Excel & Only Show a UserForm

  • is there a way to hide or minimise excel so that it isnt seen in the background, i only want the user to see the forms i have created in visual basic


    any help would be appreciated

  • This should work for you:


    To minimize Excel you can do the following:

    Code
    Application.WindowState = xlMinimized


    To restore Excel you can do the following:

    Code
    Application.WindowState = xlNormal



    I'm not sure if your userform will remain on the screen though, give it a try and let us know.

  • yeah it minimized but so did the userform, it flashes on the start bar and when u click the userform displays and the workbook stays minimised, any further ideas?

  • Hi bigandyt,


    Do you really need to hide Excel? Is this a flashing screen problem whilst you codes working?


    Anyway here are 2 approaches to the problem.
    You can set Application.Visible = False


    or you could move Excel off of the screen area.


    The following code will currently do the moving style. uncomment the lines in order to change to the visible approach


    Put this code in the userform code module.
    Click the userform to hide/reveal excel.



    Trouble with both of these approaches is if anything goes wrong and your code bombs the state of excel may completely confuse and annoy the user.


    Use with due care and attention!

    [h4]Cheers
    Andy
    [/h4]

  • just thought i'd message back to say thanks so much, really happy cuz now the program looks a little more professional. What you said bout setting it visible = false was spot on, i appreciate all the time given helpin me out guys,


    cheers


    Andy

  • hey


    Just a follow up... if you do use Andy's approach by bumping the application off the screen, or making it visible = false, you may want to use some error handling in your code.


    for example:


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!