所以我希望自动为 PDF 添加书签。我成功执行了前几个循环,但随后出现故障并且没有为正确的位置添加书签。同样,我想知道 ^f 和 ^b 是否有更好的替代品。这是我到目前为止的代码:
ActiveWorkbook.FollowHyperlink "C:\Test.pdf"
Dim searchString As String
'Create loop using variable i
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 ```