VBA update data from Internet Explorer and copy to Excel?

M

Mauricio Harger

Hi,

I would like to update data from the internet automatically with VBA. I have
already automated opening IE in the correct link with VBA. Now I need to
find the data (it is sometimes in different place) and copy to excel. Does
anybody has a routine to do it? Thanks,
 
T

Tom Ogilvy

From a previous post by Jake Marx:

http://groups.google.com/groups?selm=uqUIhs0CBHA.1644@tkmsftngp05

----------------------

From: Jake Marx ([email protected])
Subject: Re: Controlling IE5 from VBA in Excel 2000
View: Complete Thread (5 articles)
Original Format
Newsgroups: microsoft.public.excel.programming
Date: 2001-07-12 20:23:59 PST

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
--------------------- Regards,Tom Ogilvy"Mauricio Harger"
 

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