![command to find word in pdf command to find word in pdf](http://4.bp.blogspot.com/-Qn8Ya66jrig/TnSH6nQrh_I/AAAAAAAADrI/u72SPndh7Nk/s1600/ScreenShot001.png)
So, while the macro is running if you accidentally make another window active, it will not give the desired results. Note that SendKeys can be unreliable mainly because it literally sends the command (keys) to the active window.
COMMAND TO FIND WORD IN PDF PDF
When you run this code, the PDF file will get focus and search string will be highlighted, like this 'Type the search string in the find box that opens 'The second argument "true" implies that Excel will wait for the keys to be processed 'Send "CTRL + F" keys to the opened PDF to invoke find within that file While DateDiff("s", waitTime, Now) & amp amp amp amp gt 2 'Wait time for a couple of seconds for the PDF file to fully load 'Your search string - case-insensitive, as in actual PDF search 'if your Excel and PDF are in separate folders 'Make sure to provide a complete path to the PDF here You can follow along the comments in the code. Then we will use the SendKeys function to first invoke search (using Ctrl + F), type the search string and send “enter” key to perform the actual search operation. In this we will simply open the PDF file specified, using FollowHyperlink. Example 1: Using SendKeys in Acrobat Reader
![command to find word in pdf command to find word in pdf](https://www.addintools.com/documents/office/images/where-save-as/word-save-as-menus-689-498.png)
We will look at two examples, one that works with Acrobat Reader and a second that should be used if you have Acrobat Pro licensed version. In this article we will see how you can search for a string in a PDF file and highlight it using Excel VBA.