title: Find on Page using shell
body: <p>I'm using VBA in MS Access. I'm trying search through ie tabs (15 of them) bring the found tab to the foreground, maximise it, then find on page a string i'm searching for. I can find the tab using the code below but its not maximising the window and nor are the send keys working to find on page. Is there a way using the shell to do this?</p>
  
  <pre><code>Option Compare Database
  
  #If Win64 Then
      Private Declare PtrSafe Function SetForegroundWindow Lib "user32" _
                 (ByVal hWnd As LongPtr) As LongPtr
  #Else
      Private Declare Function SetForegroundWindow Lib "user32" _
                 (ByVal hWnd As Long) As Long
  #End If
  
  
  
  Private Sub P2_Click()
  Dim sURL As String
  Dim strSearch As String
  Dim SWs As Object
  
  
  sURL = CStr(Me.tblOdds_1_sURL)
  strSearch = Mid(Me.P2, 1, 5)
  
   'get windows
   Set SWs = CreateObject("Shell.Application")
  
    For Each ow In SWs.windows
  
  
      If ow = "Internet Explorer" _
      And sURL = Trim(ow.Document.Location) Then
  
      SetForegroundWindow ow.hWnd
  
      SendKeys "^f", False
      SendKeys strSearch, False
      SendKeys "{ENTER}", False
      SendKeys "{ESC}", False
  
  End If
  Next ow
  
  Set SWs = Nothing
  
  End Sub
  </code></pre>