Solved

Getting data from webpage using WebBrowser

Posted on 2003-10-30
8
186 Views
Last Modified: 2010-05-01
I'm trying to get data from a webpage into my VB app.  The department I'm in submits all of their defects in TeamTrack (this is the website).  We also need to list all these defects in some sort of defect log (my vb app).  I would like to catch all the info I need for the defect log when they submit the defect in teamtrack.  I messed around with another intranet site we use and I was able to get values from the site by using the document property of WebBrowser control - code: Text1.Text = WebBrowser1.Document.Forms("frm").lastname.Value  I'm having trouble with the TeamTrack website, and I think, but I'm not sure, it's because the TeamTrack website is in frames.  Any ideas on how I can do this?


I'm in the process of researching as I'm not sure of the best way to go about doing this. I came across the WebBrowser control so I'm trying to accomplish what I need to do with it.  If anyone has a simpliar or more efficient solution, please let me know.

Sorry this is so long.  Any help would be greatly appreciated.  Thank you in advance.
0
Comment
Question by:Sam8932
  • 4
  • 3
8 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9652361
document object has a Frames property collection, you could use it to navigate each frame and get data as usually do (each frame is a document object itself)
0
 

Author Comment

by:Sam8932
ID: 9652539
Thanks Richie.  Could you provide an example (some code) if it's not too much trouble?  I would appreciate it.  

Thanks,
Sam
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9653125
Option Explicit

Dim WithEvents ie As InternetExplorer
Sub test()
Set ie = New InternetExplorer
With ie
    .navigate "C:\A_project\frames_main.htm"
    .Visible = True
End With
End Sub


Private Sub ie_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is ie) Then
    Dim iedoc As HTMLDocument, f As Integer
   
    For f = 0 To ie.document.frames.Length - 1
        Set iedoc = ie.document
       
        Debug.Print iedoc.frames.Item(f).document.body.innerText
        Debug.Print "***************************************"
    Next f
End If
End Sub




0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Sam8932
ID: 9722633
Richie,
I'm testing the code you listed above and I keep getting the error message 'Class does not support Automation or does not support expected interface'.  The error is occuring at the line 'Set ie = New InternetExplorer'.  Any suggestions?  I'm really struggling with this.  Again, I appreciate you help.  Thanks again.
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 90 total points
ID: 9722768
That code doesn't uses Webbrowser control but Internet explorer itself (the approach is the same).
i tested it and it works.
0
 

Author Comment

by:Sam8932
ID: 10164378
I've awarded the points to Richie for his help.  I'm sure his code works, but I've been pulled from the project and I'm unsure when I'll be working on it again.  I hope Richie (or someone) will be able to help when/if I begin to work on this problem again.  Thanks.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 10252482
You would be welcome anytime. Thanks for "A" grade.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

789 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