Avatar of Roger
Roger
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Display a web page (automatically) without any navigation ctls. How to disable navigation ctls built into individual WEB PAGES?

I have an xl-based system for 'clipping bits' of web pages to create images.
To avoid copyright issues, I must be certain of the url of each image that is 'clipped'.

Currently -  I pre-identify the url and call it:
    Set oIE = CreateObject("InternetExplorer.application") (or via google)
    oIE.Visible = True
    oIE.navigate ("http://bbc.co.uk")
    oIE.Visible = True
    oIE.AddressBar = 0
    oIE.StatusBar = 0
    oIE.Toolbar = 0
    oIE.MenuBar = 0

Then make snapshot to get the graphic:
    Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
- then crop it.

QUESTION:
Although I suppress the oIE. 'bars' (code above), I cant disable any navigation tools that are built into the WEB PAGE from being used to navigate to other pages.

Is there a way of disabling navigation tools that are built into individual WEB PAGES?


Thanks!
Kelvin
VBAWeb Browsers

Avatar of undefined
Last Comment
Roger

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Fabrice Lambert

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Roger

ASKER
Fabrice:

.... Investigating quality of image (for screenshot)

Thanks!
Kelvin
Fabrice Lambert

Sorry, I do not understand what you mean by "Investigating quality of image (for screenshot)"

Plus, the only legal way to "avoid copyright issues" is to ask the author for permission to use the images.
Roger

ASKER
Fabrice:
Its running. Good quality graphic, thanks.

However, I  need to disable navigation controls within the displayed page.
I must also retain scroll bars functions, so I can read the whole web page.

Can you help with event code to intercept the clicking of navigation controls?

Thanks
Kelvin
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Roger

ASKER
Sorry, our msgs crossed.
I just wanted to see what the quality of web images looked like on a UserForm ctl. They look great.

Copyright: agreed. What I'm trying to do is to ensure that the project always saves the url for a 'captured' image, so I can be sure permission is requested, and requested  accurately.

Kelvin
Roger

ASKER
The following code loaded a web url (UserForm_Initialize()) and prevented the clicking of hyperlinks in the resultant web page (WebBrowser1_BeforeNavigate2).

 cancelNavigate (As Boolean) controlled when WebBrowser1_BeforeNavigate2 set Cancel = true, so that cancel = false when the web page was loading.

If readers have improvements I'd be glad to know them. At present List boxes in web pages OPEN, but items cannot be selected when cancelNavigate = true. To close the listBox, simply click the list box Caption a second time.

Option Explicit
Private cancelNavigate As Boolean

Private Sub UserForm_Initialize()
    cancelNavigate = True
    Me.WebBrowser1.Navigate "http://bbc.co.uk"
    cancelNavigate = False
End Sub

Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
    If cancelNavigate = False Then
        'MsgBox "Cancel = true"
        Cancel = True
    End If
End Sub
Roger

ASKER
Thanks
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.