How to Fix Slow RetrieveJavascriptValue in Microsoft Access EdgeBrowserControl
Question details
The user is experiencing significant performance delays when calling RetrieveJavascriptValue in the Microsoft Access EdgeBrowserControl and needs a faster way to detect page completion and retrieve data.

- Product
- Microsoft Access 365
- Device & OS
- not provided
- Scenario
- Automating web pages within an Access database application and repeatedly querying the browser control to detect dynamic page completion.
- Observed behavior
- RetrieveJavascriptValue takes several seconds per call, causing severe inefficiency during web automation, whereas ExecuteJavascript runs much faster.
Ensure you have access to the target website's API documentation and a basic understanding of VBA HTTP requests, as optimizing this process often involves shifting from DOM scraping to direct API calls.
Use REST API and XMLHttpRequest Instead of DOM Scraping
Bypass the slow browser control value retrieval by making direct HTTP requests to the web server using VBA.
Repeatedly calling RetrieveJavascriptValue forces Microsoft Access to marshal data back and forth between the Edge browser process and VBA, which introduces massive overhead. If the target web application has a REST API, you can communicate with it directly.
Even if some manual user interaction is required for final submission, fetching or posting the bulk of the data via XMLHttpRequest (XMLHTTP) will drastically improve performance.
Use your browser's Developer Tools (F12) on the Network tab to identify the exact API endpoints the web application uses to fetch or submit data.
Use ExecuteJavascript in your EdgeBrowserControl to extract the current session cookies (document.cookie) so you can authenticate your direct requests.
Create an MSXML2.XMLHTTP object in your Access VBA code. Set the request headers with your extracted cookies and send the GET or POST requests directly to the server.

Optimize DOM-State Checks via ExecuteJavascript
Reduce the frequency of RetrieveJavascriptValue calls by offloading the waiting logic to the browser itself.
Utilize Alternative Automation Tools
Switch to dedicated automation software if the built-in EdgeBrowserControl continues to limit your application's responsiveness.
Discover WPS Office: A Lightweight Alternative to Microsoft Office
While Microsoft Access handles complex database automation, WPS Office provides a highly efficient, lightweight, and free solution for your everyday document, spreadsheet, and presentation needs. Experience seamless compatibility without the heavy resource drain.
- 1. Download the Installer: Visit the official WPS website and download the free installation package for your operating system.
- 2. Install the Software: Run the setup file and follow the quick on-screen instructions to install the suite.
- 3. Open Your Files: Launch WPS Office and instantly open your existing Word, Excel, and PowerPoint files with perfect formatting retention.

Frequently Asked Questions
Why is ExecuteJavascript faster than RetrieveJavascriptValue in Microsoft Access?
ExecuteJavascript sends commands to the browser engine asynchronously without expecting data back. RetrieveJavascriptValue is synchronous and requires the system to marshal and translate data types between the Edge browser process and the Access VBA environment, resulting in significant overhead.
Can I share authentication cookies between EdgeBrowserControl and XMLHTTP?
Yes. You can extract the active session cookies by executing a script to return 'document.cookie' from the browser control. You can then pass this cookie string into the 'SetRequestHeader' method of your XMLHTTP object in VBA to authenticate your direct API requests.
How can I allow user intervention if I use a REST API for automation?
You can use XMLHTTP to rapidly fetch the bulk data and populate it directly into an Access form. The user can then review, modify, and approve the data natively in Access before you trigger a final API POST request to submit the verified data.
Is the WebBrowser control (Internet Explorer) faster for DOM scraping?
The legacy Internet Explorer WebBrowser control had tighter native COM integration with VBA, which sometimes made DOM traversal feel faster. However, IE is deprecated, inherently insecure, and unable to render modern web pages. Migrating to API-based logic with the EdgeBrowserControl is the recommended modern approach.




