Forum Discussion

udaytheja's avatar
udaytheja
Copper Contributor
Apr 04, 2026

Edge Browser Control stealing Focus

I am facing an issue with the Microsoft Access Edge (WebView2) browser control in VBA Office 365.

I have two forms displayed side by side:

  • The first form contains a grid/list of records.
  • The second form contains an Edge browser control that loads an HTML file.

When a record is selected (or navigated using arrow keys) in the grid, I dynamically delete and recreate an HTML file with details of the selected record, and then call the Edge browser control’s Navigate method to load that file.

The problem is:

  • Arrow key navigation works correctly in the grid when the Edge browser control is not used.
  • Once I add the Edge browser Navigate call, the browser control takes focus.
  • After that, arrow key navigation in the grid stops working because focus shifts to the browser.
  • Attempts to manually set focus back to the grid (SetFocus, timers, etc.) are not reliable. Tried this in documentcomplete event also, but not working.
  • The issue seems to be related to the asynchronous behavior of the Edge browser control, which keeps reclaiming focus.

What is the best way to reliably prevent or reclaim focus from the Edge browser control so that keyboard navigation in the grid continues to work smoothly?

1 Reply

  • Viorel's avatar
    Viorel
    Brass Contributor

    Maybe the browser control can be disabled and then reenabled on Document Complete event?