Set Magnification for URL in MS Access WebControl Using VB

In MS Access, I have a webcontrol on a form.  I want to be able to force magnification for the URL to 125 percent.  I have found several articles on Google about this, but nothing seems to work for me.  Here is what I have now - the last line represents the best suggestion I was able to find on the intrawebs:

DoCmd.OpenForm "WebBrowser", acNormal
DoCmd.Maximize
       
Forms!WebBrowser.RecordSource = "Wordpress"
    Forms!WebBrowser.Filter = "[Select]=-1"
    Forms!WebBrowser.FilterOn = True

'''''  the URL comes from tbWordpress from either be in Site, NewPost or NewPage in the Wordpress table
    Forms!WebBrowser!WebBrowser0.ControlSource = "NewPost"
   
   
    Forms!WebBrowser!WebBrowser0.ExecWB OLECMDID_OPTICAL_ZOOM, ExecOpt.OLECMDEXECOPT_DONTPROMPTUSER, 150, DBNull.Value
Chuck MorrisonIndependent Consultant (Healthcare)Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertConsultingCommented:
Hmm, instead of using akward API calls, what about using a textbox right above the webbrowser control ?

Simply configure the texbox in design mode, have VBA update its data, and you're done.
Chuck MorrisonIndependent Consultant (Healthcare)Author Commented:
Text box for what?  The URL?  The zoom level?
Fabrice LambertConsultingCommented:
For the URL of course.
Choose a font and its size matching your needs, and never ever touch it again.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Chuck MorrisonIndependent Consultant (Healthcare)Author Commented:
The URL for the WebBrowser control is variable as is (possibly) the magnification, so I can't set and forget.  The control needs to be magnified not the URL.  Some webpages will need to be 125%, some will need to be 75%.  I need help understanding how putting a URL in a text box with a specific font is going to change the magnification in the control?
Fabrice LambertConsultingCommented:
So, this is the control, not the URL.
I want to be able to force magnification for the URL to 125 percent.
Ehence the confusion.
Gustav BrockCIOCommented:
This works for me:

Private Sub SetZoomLevel(Optional ByVal InOut As Long)

    Const DefaultZoomLevel  As Long = 0
    Const MinimumZoomLevel  As Long = -2
    Const MaximumZoomLevel  As Long = 2
    Const ZoomOffset        As Long = 2

    Static CurrentZoomLevel As Long
    
    Dim ZoomLevel           As Long
    
    Select Case Sgn(InOut)
        Case 1
            If CurrentZoomLevel < MaximumZoomLevel Then
                CurrentZoomLevel = CurrentZoomLevel + 1
            End If
        Case -1
            If CurrentZoomLevel > MinimumZoomLevel Then
                CurrentZoomLevel = CurrentZoomLevel - 1
            End If
        Case 0
            CurrentZoomLevel = DefaultZoomLevel
    End Select
    
    ZoomLevel = CurrentZoomLevel + ZoomOffset
    
    Me!Webbrowser0.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, (ZoomLevel)

End Sub

Private Sub ZoomIn_Click()

    SetZoomLevel 1

End Sub

Private Sub ZoomOut_Click()

    SetZoomLevel -1

End Sub

Private Sub ZoomZero_Click()

    SetZoomLevel

End Sub

Open in new window

The trick is (ZoomLevel) which forces a read-only value to be passed.

Note however, that the zoom effect may not be what you expect; it only adjusts the size of the fonts and these will on many sites be supervised by the page itselft, not this setting.

See the attached demo.
Zoom.accdb

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.