I’m trying to set a Access form web browser (wbmap2) control source by creating a text string and then using the property setting wbmap2.ControlSource = textstring. This is the web browser that comes with Access 2010, NOT the ActiVex variety. I want to use Bing Map scriptcontrol V8, so I have loaded some HTML code from their SDK site.
I first built a long text string in VBA and tried .navigate, but this only works with activex variety of the control.... and with even with the Activex the string didn't work, even though it seemed to be the code specified by Bing Maps (SDK V8, load map asyncHTML)
So I then saved the code in a file, OpenMap.html.
When I open that file in IE 11 (or Chrome) it opens as it should, but when I use this file asthe web browser control source , it throws a script error.
I first initialize the browser when the form opens, then try and set the control source when the document completes. At that point there is a script error that points to a problem with code in the saved file- it seems to be in the URL bit.
This may an issue for HMTL developers, but I can’t see why a file that works OK when loaded directly to a browser then doesn’t work as a control source. Is it a security setting in Access / the webbrowser control?
VBA code:
Can't seem to post the HTML code as I'm a newbie to this game...
Ideas / experience gratefully received...web and web browser controls are new territory for me!
I first built a long text string in VBA and tried .navigate, but this only works with activex variety of the control.... and with even with the Activex the string didn't work, even though it seemed to be the code specified by Bing Maps (SDK V8, load map asyncHTML)
So I then saved the code in a file, OpenMap.html.
When I open that file in IE 11 (or Chrome) it opens as it should, but when I use this file asthe web browser control source , it throws a script error.
I first initialize the browser when the form opens, then try and set the control source when the document completes. At that point there is a script error that points to a problem with code in the saved file- it seems to be in the URL bit.
This may an issue for HMTL developers, but I can’t see why a file that works OK when loaded directly to a browser then doesn’t work as a control source. Is it a security setting in Access / the webbrowser control?
VBA code:
Code:
Private Sub Form_Load()
wbmap2.ControlSource = " about:blank"
Me.Refresh
End Sub
Private Sub wbmap2_DocumentComplete(ByVal pDisp As Object, URL As Variant)
'wbmap2.ControlSource = "=("" [bing maps normal web address]"")" 'works OK
wbmap2.ControlSource = "=""[file location on my computer]"""
Me.Refresh
End Sub
Can't seem to post the HTML code as I'm a newbie to this game...
Ideas / experience gratefully received...web and web browser controls are new territory for me!