+ Reply to Thread
Results 1 to 6 of 6

VBA To Determine if Window (IE) Is Minimized

  1. #1
    Registered User
    Join Date
    09-07-2011
    Location
    Sacramento
    MS-Off Ver
    Excel 2007
    Posts
    37

    VBA To Determine if Window (IE) Is Minimized

    Can anyone explain how I can use Excel VBA to determine the state (visible or minimized) of an Internet Explorer window?

    I know the windows handle of the window I am interested in. I thought I could get the info using the API GetWindowInfo function - but have not been successful getting the function to work at all. I have very little experience using API functions. So, if GetWindowInfo is the way to go about it, please provide some sample code. If there is another/better way - I can go that route too. Thanks.
    Last edited by Filibuster; 02-25-2015 at 10:06 PM.

  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,258

    Re: VBA To Determine if Window (IE) Is Minimized

    Hello Filibuster,

    To check if the window is visible, you need to use the API call GetWindowLong and test the Visible style bit (&H10000000). To check if the window is minimized to the task bar, you need to use the API IsIconic.

    Here is some example code. Copy all this code to a separate VBA module in your project.

    Please Login or Register  to view this content.
    ]
    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
    09-07-2011
    Location
    Sacramento
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: VBA To Determine if Window (IE) Is Minimized

    Thanks Leith - the code works beautifully. I'll apply to my application and see how it goes.

    Since I started down the GetWindowInfo path (unsuccessfully), do you have any code that would demonstrate how to correctly use that API call? I get bothered when I cannot get something to work as I usually learn a lot by solving mysteries - even if I ultimately abondon the approach.

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

    Re: VBA To Determine if Window (IE) Is Minimized

    Hello Filibuster,

    You asked for it. I have included all the window style and window extended style constants for reference. You may want to use them for some later project.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-07-2011
    Location
    Sacramento
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: VBA To Determine if Window (IE) Is Minimized

    Thanks Leith. This is excellent. I learned so much for both of your posts. I have incorporated your original post into my project and it is working great. Thanks again.

  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,258

    re: VBA To Determine if Window (IE) Is Minimized

    Hello Filibuster,

    You're welcome. Glad I could help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem manipulating IE window (opens minimized)
    By mattmc419 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-25-2014, 05:41 PM
  2. Cannot maximize minimized Exccel window
    By contaminated in forum Excel General
    Replies: 5
    Last Post: 09-18-2013, 09:05 AM
  3. Replies: 11
    Last Post: 08-25-2013, 04:41 AM
  4. Full screen after window is minimized
    By lsteinbach in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2013, 06:01 PM
  5. [SOLVED] Help window opens minimized
    By Dick L in forum Excel General
    Replies: 0
    Last Post: 09-21-2005, 08:05 PM

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