Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opposite to Shell command

Status
Not open for further replies.

Accessdabbler

Technical User
Oct 15, 2002
728
CA
I am using the SHELL command to launch an Internet Explorer window.

How to I then issue a command to CLOSE that window?

If I'm not being clear, here's what I am doing:

User pushes a button on a form. A webpage opens up and some data is downloaded from a website. I then need the webpage to close. User does not need to see the webpage.

The download is working great but I am getting a blank webpage sitting there when I push the button. Using code like:

Application.quit closes MSAccess instead of IE!!
 
There is no Property of Shell to close a app/window. You will have to close that app using an API function.

So to open and close an IE Window follow the example I posted below.

You have to set a Reference to "MICROSOFT INTERNET CONTROLS"

Code:
Dim myWindow As InternetExplorer

Set myWindow = New InternetExplorer
With myWindow
    .Visible = True
    .Navigate ("[URL unfurl="true"]www.microsoft.com")[/URL]

'YOUR CODE FOR THE DOWNLOAD GOES HERE

    .Quit
End With

If the user don't need to see the page set
.Visible = False
 
Will this work with Access97? I tried it but I get an error that "Internet Explorer" is not defined.
 
The first line. It doesn't recognize InternetExplorer as a variable type.
 
You have to set a Reference to "MICROSOFT INTERNET CONTROLS"

in any module window
goto -> Tools -> References -> and click on "MICROSOFT INTERNET CONTROLS" and press OK.

I believe Acc97 have this.
 
Hmm, didn't find anything called References under Tools. Under Insert I can add an ActiveX control called Microsoft Web Browser.

However, there is no option for Navigate. I'm wondering if there is some plugin or option I need to install.
 
You need to be in the Module window, the window where the code is written.
You are in the design view of a form NOT THERE.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top