Solved

vb read table from IE web page

Posted on 2006-07-16
1
390 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

10 Experts available now in Live!

Get 1:1 Help Now