count the number of hidden windows

  • I need to count the number of windows that are hidden and display a pop-up window. My code keep giving me "0 hidden windows" no matter how many windows I've hidden, please help.

    Sub Hiddenwindows() [INDENT]Dim Cnt as Integer
    Dim Win as window
    For each Win in Windows
    If Not Win.Visible then Cnt = Cnt +1
    Next Win
    Msgbox Cnt & " hidden windows"[/INDENT]
    End Sub
  • Code Tags Added
    Your post does not comply with our Forum RULES. Use code tags around code.

    Posting code between


    tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window.

    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

  • Like this right?
    Thank you for your help.


    [/SIZE][/FONT][/COLOR][/align][align=left][COLOR=#252C2F][FONT=Courier][SIZE=12px]Sub Hiddenwindows()[/SIZE][/FONT][/COLOR][/align]Dim Cnt as IntegerDim Win as windowCnt=0For each Win in WindowsIf Not Win.Visible then Cnt = Cnt +1Next WinMsgbox Cnt & " hidden windows"[align=left][COLOR=#252C2F][FONT=Courier][SIZE=12px]End Sub[/SIZE][/FONT][/COLOR][/align][align=left][COLOR=#252C2F][FONT=Helvetica][SIZE=13px]



Participate now!

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