だから私がやろうとしているのは、PDFを調べて、CTRL + Fのキーを送信して列Cからテキストの文字列を見つけ、最初の結果を強調表示してから、単語をブックマークする別の送信キーです。ループしようとすると、最初の 3 つは成功しますが、失敗します。私は Foxit を使用していますが、sendcode に代わるより良い方法が見つからないようです。API Foxit ガイドを調べましたが、必要なものに固有のコードは見つかりませんでした。
Sub BookmarkingWithSendKeys()
ActiveWorkbook.FollowHyperlink "C:\Test.pdf"
Dim searchString As String
'Create loop using variable i, searching PDF in column C (3 if you do R1C1).
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For I = 1 To FinalRow
searchString = Cells(I, 3).Value
'Send "CTRL + F" keys to the opened PDF to invoke find within that file
'The second argument "true" implies that Excel will wait for the keys to be processed before returning control to the macro.
SendKeys "^f", True
'Type the search string in the find box that opens
SendKeys searchString, True
'Hit enter to perform the search
SendKeys "{Enter}", True
'Bookmark highlighted text
SendKeys "^b", True
'Hit enter to perform the bookmark
SendKeys "{Enter}", True
Next I
Application.DisplayAlerts = True
End Sub