Solved

Getting data from webpage using WebBrowser

Posted on 2003-10-30
8
183 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
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.

 

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

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 103
VBA open file from excel cell 4 36
Updates not working for MS Windows 7 12 152
VB6 ListBox Question 4 33
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now