Thursday 20 August 2015

Remove Margin ('White Spaces') from WebBrowser


This seems to be a common question for the web browser in MS Access. Firstly, the standard webbrowser cannot be modified to remove these. However an active X Webbrowser can be. I have made a demo to show you how it works, This can be downloaded below.



To start off you need to insert an activeX browser, depending on what version of Access you have depends on how to insert one but for most versions this is how you add one, follow these steps:

Go to the slide where you want to insert the control.
If the Control Toolbox is not already visible, point to Toolbars on the View menu, and then click Control Toolbox.
Click the More Controls button in the Control Toolbox.

Once you have added the browser you need to populate it and format it, using the code below will do this for you:

Option Compare Database

Private Sub Form_Load()
With WebBrowser0 'What every your webbrowser name is
        .Navigate "http://searchengineland.com/figz/wp-content/seloads/2014/07/google-logo-black-1920-800x450.jpg"
    End With
End Sub

Private Sub WebBrowser0_Updated(Code As Integer)

    With WebBrowser0.Document.Body
        .Scroll = "no"
        .Style.MarginTop = 0
        .Style.MarginLeft = 0
        .Style.MarginRight = 0
        .Style.MarginBottom = 0
        .Style.BorderStyle = "none"
    End With

    End Sub


this is all that's needed. Once this is in you should see something like this:


Disclaimer

This file has been made by Me, Bobby Bates, By downloading this you are agreeing that you are using this of your own accord and that you will test this out on a blank project before implementing into your desired one. I will not be held liable for anything that could go wrong.

Leave a Reply

Thank You for Leaving your comment :) Why not read another post?

Subscribe to Posts | Subscribe to Comments

Popular Post

- Copyright © Bobby's World - Powered by Blogger -