Solved

Getting data from webpage using WebBrowser

Posted on 2003-10-30
8
182 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
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…

757 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

19 Experts available now in Live!

Get 1:1 Help Now