Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Webbrowser and DocumentComplete

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
grove - 14 Apr 2008 19:25 GMT
I am using the DocumentComplete event to grab the text from a web
page.  The MS documentation suggests of course I need to check the
page has finally loaded.

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object,
                                        URL As Variant)
  If (pDisp Is WB.Object) Then
     Debug.Print "Web document is finished downloading"
  End If
End Sub

When I try this it complains that "Object doesn't not support this
property or method"

What's wrong?

grove
roger - 14 Apr 2008 22:51 GMT
> I am using the DocumentComplete event to grab the text from a web
> page.  The MS documentation suggests of course I need to check the
[quoted text clipped - 11 lines]
>
> What's wrong?

Is it because you are using "WebBrowser1" and "WB" in the same procedure?

If that's not the reason, does this work?

   "If (pDisp Is WB) Then"

Curiously
"pDisp Is WB.Object"
works in MSAccess, but not in my version of Excel

Signature

roger

grove - 15 Apr 2008 09:37 GMT
WebBrowser1 was just my typo when I was cutting and pasting to this
post.

  "If (pDisp Is WB) Then"

Certainly does work and gives the correct result in my procedure, so
seems an error in the documentation.  Worrying that there appears to
be some inconsistency with versions of Excel.

If you have any ideas why, or find which is the correct syntax for
your version, perhaps you would let me know.  I am on Excel 2002 SP3.

Thanks

grove
roger - 16 Apr 2008 08:03 GMT
> WebBrowser1 was just my typo when I was cutting and pasting to this
> post.
[quoted text clipped - 7 lines]
> If you have any ideas why, or find which is the correct syntax for
> your version, perhaps you would let me know.  I am on Excel 2002 SP3.

Sorry, I don't know. I am using the same version of Excel.

Perhaps it's one of the 1483279 bugs and features that nobody ever got
around to fixing.

Signature

roger

grove - 16 Apr 2008 23:07 GMT
I probably need to start a new thread, but I will give it a try.

This code works fine in Excel 2002

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

Dim sGetText As String

If (pDisp Is WB) Then
   sGetText = WB.Document.Body.InnerText

...do something with sGetText ...

End Sub

But in Excel 2003 "sGetText" is empty for the same web page.

Thanks

grove
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.