[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Shell Command to Start IE Won't Open It Maximized

Posted on 2005-04-26
7
Medium Priority
?
1,023 Views
Last Modified: 2008-01-09
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?
0
Comment
Question by:leslieinva
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Chuck Wood
ID: 13871540
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
 

Author Comment

by:leslieinva
ID: 13875752
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
 
LVL 16

Accepted Solution

by:
Chuck Wood earned 375 total points
ID: 13875851
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:leslieinva
ID: 13876971
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
 
LVL 16

Expert Comment

by:Chuck Wood
ID: 13877357
Yes, you can activate the application:

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

Chuck
0
 

Author Comment

by:leslieinva
ID: 13877577
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
 
LVL 16

Expert Comment

by:Chuck Wood
ID: 13878537
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question