?
Solved

Getting data from webpage using WebBrowser

Posted on 2003-10-30
8
Medium Priority
?
192 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
7 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 360 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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 …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

864 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