Solved

vb read table from IE web page

Posted on 2006-07-16
1
399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

728 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