I am using sendkeys to manipulate the options in Find and Replace. However, when it comes to taking screenshots, it captures the screenshot without the results. Most of my searches (99%) return no result. I just have to take a screenshot of the entire active screen (I use a dual monitor) and save the file as a jpg or pdf.
The code I have so far is
Sub Seachpdfer()
 Dim searchquery As Range
 Dim mystring As String
 Dim mypic As Shape
 Set searchquery = Worksheets("Query").Range("AA2:AA10001")
 For Each cell In searchquery
    mystring = cell.Value
    If cell.Value = "" Then
        Exit For
    End If
  Worksheets("Restricted List").Select
  Worksheets("Restricted List").Range("A1").Activate
  Worksheets("Restricted List").Range("I1").Activate
  Application.CommandBars("Edit").Controls("Find...").Execute
  Application.SendKeys ("%n" & mystring)
  Application.SendKeys ("{TAB}{TAB}")
  Application.SendKeys ("Sheet")
  Application.SendKeys ("{ENTER}")
  'Application.SendKeys ("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}")
  Application.SendKeys ("{TAB}{TAB}")
  Application.SendKeys "%i", True  ' This clicks the Find button on the Find and Replace dialog
' This is where it all breaks. I tried using doevents and tried using application wait. But the screenshot I get does not show
'The search result We could not find what....."
  Application.SendKeys "({1068})", True
  DoEvents
  ThisWorkbook.Worksheets("Staging").Activate
  ActiveSheet.Paste
  sFileName = ThisWorkbook.Path & "\" & mystring & ".jpg"
  For Each mypic In ActiveSheet.Shapes
        mypic.Select
       Call PictureExport ' This function converts it to a chart and prints out the pdf
   Next
 Next
End Sub
Any help will be much appreciated. Thank you.
