hide excell when using vba forms
Eliminate Pivot Table Annoyances
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: hide excell when using vba forms

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    Jason in Boston MA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Does anyone know if there is a way to hide the entire excel window or to minimize it so that only a userform will be seen on the desktop?

  2. #2
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    This makes excel not hide but minimized:

    Private Sub UserForm_Activate()
    Application.WindowState = xlMinimized
    End Sub

    Private Sub UserForm_Deactivate()
    Application.WindowState = xlNormal
    End Sub


    And you should use

    UserForm1.Show vbModeless

    to show userform

    regards



  3. #3
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You can set Userform's Showmodal property to false in design view_properties window if you dont want to use UserForm1.Show vbModeless. Just same...



  4. #4
    New Member
    Join Date
    Apr 2002
    Location
    Jason in Boston MA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the code This should make things look a lot cleaner.

  5. #5
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    It makes me happy if you can solve your problem with this way.

  6. #6
    New Member
    Join Date
    Apr 2002
    Location
    Jason in Boston MA
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    code works great but is there a way to make all windows (other programs)that are open minimize?

  7. #7
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    If you are not closer to APIs then this should be a little confused what it does but just does what you want.

    Open the user form module and paste this codes.

    'These two lines should be placed on declaration
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Dim currState

    Private Sub UserForm_Activate()
    currState = Application.WindowState
    Call MinimizeAll
    Application.WindowState = currState
    Application.WindowState = xlMinimized
    UserForm1.Show vbModeless
    End Sub

    Private Sub MinimizeAll()
    Call keybd_event(&H5B, 0, 0, 0)
    Call keybd_event(77, 0, 0, 0)
    Call keybd_event(&H5B, 0, &H2, 0)
    End Sub

    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    Application.WindowState = currState
    End Sub

    regards


User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com