Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Controlling IE5 from VBA in Excel 2000

53 views
Skip to first unread message

George Stevens

unread,
Jul 12, 2001, 11:00:40 PM7/12/01
to
Can anyone refer me to a book, technical article, web site, etc. that shows
how I can
control the Internet Explorer from VBA in Excel?

At the MINIMUM I want to tell IE5 to "Select All" and then to "Copy" to the
clipboard. I already have operational VBA code that pastes the text from
the web page into a worksheet and then picks out the info I desire.

At the MAXIMUM I want to invoke an instance of IE5 from VBA in Excel. Give
IE5 the commands necessary to get the web page I want into IE5, and then do
the MINIMUM mentioned above.

Someone must have written some really good stuff on this subject, since it
seems quite useful.

Thanx in advance,

George Stevens

Jake Marx

unread,
Jul 12, 2001, 11:23:44 PM7/12/01
to
Hi George,

Here's a function that will grab the text of a web page for you:

Function sGetURLText(sURL As String) As String
Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate sURL
Do Until ie.ReadyState = 4
DoEvents
Loop
sGetURLText = ie.Document.Body.InnerText
If InStr(1, sGetURLText, "The page cannot be displayed", _
vbTextCompare) Then sGetURLText = ""
ie.Quit
Set ie = Nothing
End Function


Just pass in the URL as an argument, and the function will return either an
empty string (invalid URL) or the text of the page. Hopefully this will do
what you were looking for.

Regards,
Jake Marx


"George Stevens" <sdge...@ix.netcom.com> wrote in message
news:OrMZhf0CBHA.1940@tkmsftngp05...

jamieuk

unread,
Jul 13, 2001, 2:35:31 AM7/13/01
to
George
I don't know about a book/article/site but here's some code:

Public Sub WebCopy()

Dim IE As InternetExplorer
Set IE = New InternetExplorer

With IE
.Navigate "www.care4free.net"
.Visible = True

Do While .Busy
' Do nothing
Loop

.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER
.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER
End With

Set IE = Nothing

End Sub

HTH, Jamie.

"George Stevens" <sdge...@ix.netcom.com> wrote in message news:<OrMZhf0CBHA.1940@tkmsftngp05>...

jamieuk

unread,
Jul 13, 2001, 3:12:20 AM7/13/01
to
Did I mention setting a reference to the Microsoft Internet Controls
DLL (in the VBE choose - Tools, References)?
Jamie.

"George Stevens" <sdge...@ix.netcom.com> wrote in message news:<OrMZhf0CBHA.1940@tkmsftngp05>...

Jeff McAhren

unread,
Jul 13, 2001, 1:16:02 PM7/13/01
to
Hi George, It's a totally different approach to your problem, but Get
External Data, New Web Query is a pretty fancy way to get internet data into
Excel without interacting with, or automating IE (at least on the surface).

--
Jeff McAhren
Dallas, Texas


"George Stevens" <sdge...@ix.netcom.com> wrote in message
news:OrMZhf0CBHA.1940@tkmsftngp05...

0 new messages