Solved

Reading HTML-text in MS Internet control Component

Posted on 2001-08-08
10
184 Views
Last Modified: 2010-05-18
Hi,

Here is my problem (or your challenge):

I have a form with a MS Internet Control Component (and some buttons etc.).
When I drag an URL to this Internet Control Component, I will be able to read (and display) the HTML-text from the displayed page, so that I can filter some tags, text and links.

Can anybody tell me how I can do that?

Thanks
0
Comment
Question by:theo kouwenhoven
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 6364291
here ya go:

Private Sub Command1_Click()
WebBrowser1.Navigate "<url>"
While WebBrowser1.Busy
    DoEvents
Wend
MsgBox WebBrowser1.Document.body.innerHTML

End Sub
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 6364494
Wauw that is realy fast....

I go check it this afternoon

Thanks
0
 
LVL 2

Expert Comment

by:TrueDrake
ID: 6364672
Hi,
The lesser the points awarded, the shorter the code ;)
Enjoy
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6366095
Just a little modification to bobbit31 code:


Private Sub Command1_Click()
WebBrowser1.Navigate "<url>"
' comment this code:
'While WebBrowser1.Busy
'   DoEvents
'Wend
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

If (pDisp Is WebBrowser1.Object) Then
    MsgBox WebBrowser1.Document.body.innerhtml
End If

End Sub
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 6367090
Yes bobbit31,

It works almost exactly on the way I like it, but I get only the <BODY> part of the page, not the <HEAD> part of it....

Of course i have tried to change the "WebBrowser1.Document.body.innerhtml" in to "WebBrowser1.Document.head.innerhtml" and "WebBrowser1.Document.innerhtml", but that would be to obvious.

So what is the secret???

0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6367726
There is no secret, unfortunatelly there is no WebBrowser1.Document.innerhtml thing
8|
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 total points
ID: 6368180
here ya go:
MsgBox WebBrowser1.Document.documentElement.innerHTML
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 6368705
Great Thanx
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6368919
Bobbit31, amazingly!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6369063
thanks... glad to help!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

730 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