Solved

vb read table from IE web page

Posted on 2006-07-16
1
392 Views
Last Modified: 2008-02-01
Hi,
     I wrote this piece of code to connect to explorer, open a webpage, and copy data from there by searching for a field name...What is the easiest or efficient way to copy data from a table located on a web page ?

Dim oIE, oIEDoc
Dim aInput As Variant
'Create the IE Application object
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True

'Load page with data
oIE.Navigate ("http://172.20.41.11/test/FGPH_Detail.asp?varCrit=test-1Z&submit1=Submit+Query")
'Wait for page to load
Do While (oIE.ReadyState <> 4)
Loop

'Capture the IE document
Set oIEDoc = oIE.document
Set oBody = oIEDoc.Body
'Field Name
Text = "Customer Name"
dietype = InStr(oBody.innerText, Text)

oIE.Quit
Set oIE = Nothing
0
Comment
Question by:azcalv408
1 Comment
 
LVL 4

Accepted Solution

by:
jomacinc earned 50 total points
ID: 17120695
I would use the Internet Transfer Control to get the full HTML source of the page, you can then use string manipulation to extract the parts you need. This would save you the massive overhead of loading IE (uses far too much memory and processor time for the basic purpose it serves).

Presuming you had an Internet Transfer Control on yourt form called "Inet1":

'-----------------------------------------------------------------------------------
    Dim sHTMLSource  As String
    sHTMLSource = Inet1.OpenURL("http://www.someurl.here", icString)
'-----------------------------------------------------------------------------------

Regards, Jomac.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now