Check for instance of Internet Explorer

B

BBert

Hello Excel experts,

Couple of questions about Internet Explorer and Excel.
Whats the vba code to check if IE is running and if so, how many browser
windows are open? I want to close all windows but one. If Internet
Explorer is not running whats the code to open IE?

It would be very nice when i could read a page and bring some info from
the current browser window to excel. I know that i can do that by using
an web query but that's so time consuming. Are there alternatives?

Suppose i want the info from page:
http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:gso20r8aq48n
Can i get that without using a webquery?

Thanks in advance.
--
With Kind Regards,
BBert

April 20, 1986
Celtics (135) - Bulls (131)
Larry Bird: "God disguised as Michael Jordan"
 
B

BBert

On 26 Jan 2007 12:06:43 -0800, merjet wrote...
The following will get you to a webpage. I don't know how to extract
what you want.
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "put url here"

OK thanks for the hint. It pushed me to the right direction. I managed
to put the following together and it worked.

******************************
Sub Open_IE()

Dim intCount, objExplorer, objShell, objShellWindows, objW, strUrl
strUrl = "http://www.amazon.com"
intCount = 0
'Create instance of IE
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Visible = 1

Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

'Check for more browser windows
For Each objW In objShellWindows
If objW.FullName = "C:\Program Files\Internet Explorer
\iexplore.exe" Then intCount = intCount + 1
Next
' We want just one
If intCount > 0 Then
For Each objW In objShellWindows
If objW.FullName = "C:\Program Files\Internet Explorer
\iexplore.exe" And intCount > 1 Then
objW.Quit
intCount = intCount - 1
End If
Next
End If
objExplorer.Toolbar = 1
objExplorer.StatusBar = 1
objExplorer.MenuBar = 1
objExplorer.Width = 900
objExplorer.Height = 600
objExplorer.Left = 0
objExplorer.Top = 0
'go to Amazon and pick up the correct page
objExplorer.Navigate strUrl
End Sub


******************************
--
With Kind Regards,
BBert

April 20, 1986
Celtics (135) - Bulls (131)
Larry Bird: "God disguised as Michael Jordan"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top