Shell Command to Start IE Won't Open It Maximized

I'm tryning to open IE with some code for the click event of a button.  The code is:

 Shell ("C:\Program Files\Internet Explorer\iexplore.exe", vbMaximizedFocus)

 but when I compile the code it gives me a syntax error.  Just how do you write a Shell statement to open IE maximized with the focus?
leslieinvaAsked:
Who is Participating?
 
Chuck WoodCommented:
Sure, add the final line to the code:

    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate2 "http://www.somedomain.com"
    IE.Visible = True
    Do While IE.Busy
        intEvents = DoEvents()
    Loop
    ' maximize IE
    ShowWindow IE.hwnd, 3

Chuck
0
 
Chuck WoodCommented:
Try this:

    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate2 "http://www.somedomain.com"
    IE.Visible = True
    Do While IE.Busy
        intEvents = DoEvents()
    Loop


Chuck
0
 
leslieinvaAuthor Commented:
The procedure defined by cwood-wm-com does open IE, but it does'nt open maximized.  Is there a way to make the IE window maximized using the above method or a similar one?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
leslieinvaAuthor Commented:
Chuck,

This is great!  One more question, if there is an IE window currently open, is there a way to tell it to use the currently open window instead of opening another?
0
 
Chuck WoodCommented:
Yes, you can activate the application:

    AppActivate "WindowTitle", True ' where WindowTitle is the first part of the title of the IE window

Chuck
0
 
leslieinvaAuthor Commented:
I can't use the window title for my current application because the specific web pages I want to open don't have useful titles.  

Is there a way to alter your first piece of code with an If statement that would tell it use the current IE window to Navigate2 if an IE window was already open?  Thanks for your patients!
0
 
Chuck WoodCommented:
Sorry, I don't know of a way to do that.
I always have the user close the window and start a new one when they click the button again.

Chuck
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.