Webbrowser

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Webbrowser

Post by adam »

I'm trying to view the yahoo page by hiding the scroll bars and borders but scrolling the page to a defined location within the page.in a ms access form. I've written the following code to view yahoo when the form is loaded using the Microsoft Web Browser (activeX) control, however, the yahoo page isn't disabling the scroll bars of the web page within the form.

Does anyone now what is causing this problem and how I can fix it?

Code: Select all

Private Sub Form_Current()
wbbWebsite.Navigate URL:="http://www.yahoo.com"
End Sub

Private Sub wbbWebsite_Updated(Code As Integer)
    Dim MaxScrollY As Long
    On Error Resume Next
    With Me.wbbWebsite.Document
        MaxScrollY = .Body.ScrollHeight
        ' scroll down half page
        .ParentWindow.ScrollTo 0, MaxScrollY / 2
        .Body.Scroll = "no"
        .Body.Style.Border = "none"
End Sub
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78523
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Webbrowser

Post by HansV »

1) Your code is not valid because there is no End With corresponding to With Me.wbbWebsite.Document.

2) The code is never called.

Try

Code: Select all

Private Sub wbbWebsite_DocumentComplete(ByVal pDisp As Object, URL As Variant)
  Dim MaxScrollY As Long
  On Error Resume Next
  With Me.wbbWebsite.Document
    MaxScrollY = .Body.ScrollHeight
    ' scroll down half page
    .ParentWindow.ScrollTo 0, MaxScrollY / 2
    .Body.Scroll = "no"
  End With
End Sub
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Webbrowser

Post by adam »

Thanks for the help. How could the 3D border be removed from this?
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78523
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Webbrowser

Post by HansV »

As far as I can tell, that can't be done.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Webbrowser

Post by adam »

Yeah. I've added the line .Show3DBorder = False above the line End With. But does not seem to hide the 3D border.
Best Regards,
Adam