Executing Javascript in WebBrowser Control stopped working after upgrade to Access 2010
BACKGROUND: The following works in Access 2007, but broke when I installed 2010
I have a WebBrowser control in an Access Form; I set its location as follows
Me.WebBrowser0.ControlSource = "http://website.com"
and then execute a script in the page
Script = "StartScript(null);"
Me.WebBrowser0.Object.Document.parentWindow.execScript Script, "JavaScript"
This worked just fine in Access 2开发者_StackOverflow中文版007, but immediately after installing 2010 I got the following pop-up error:
Run-Time error '-2147024891 (80070005)':
Access is Denied.
Any ideas?
WORKAROUND:
Not sure why the following works, but it does.
Web page saved locally to hard drive, added the following line to the beginning of the file
<!-- saved from url=(0014)about:internet -->
Disabled protected mode;
Changed Me.WebBrowser0.ControlSource to
Me.WebBrowser0.ControlSource = "file://T:/foo.html"
精彩评论