Skip to main content
Participating Frequently
May 30, 2019
Question

Is there any way to click OK using vba or javascript on a Acrobat dialog box?

  • May 30, 2019
  • 1 reply
  • 1082 views

Is there any way to click OK using vba or javascript on a Acrobat dialog box?

This topic has been closed for replies.

1 reply

try67
Community Expert
May 30, 2019

Not possible with JavaScript, and I doubt it is with VBA.

Participating Frequently
May 30, 2019

I tried using vba sendkeys and it actually worked for a while.  I'm not sure what happened.  I can get the text recognition dialog to pop up using the following:

AcroApp.MenuItemExecute ("Cpt:CapturePages")

But it won't execute from there even though it did before.  I hate to turn this over to the user since it is so simple.  Executing this would save her a step.

Participating Frequently
June 4, 2019

This worked!

Public Function RecogText(strFilePath As String)

'**************THIS WORKS********************

'acroAppObj.MenuItemExecute ("Cpt:CapturePages")

Dim ItWorks As Boolean

Dim ctlCurrentControl As Control

Dim AcroApp As AcroApp

Dim PDDoc As AcroPDDoc

Set AcroApp = CreateObject("AcroExch.App")

Dim AVDoc As AcroAVDoc

Set AVDoc = CreateObject("AcroExch.AVDoc")

ItWorks = AVDoc.Open(strFilePath, TempName)

AcroApp.Show

Set PDDoc = CreateObject("AcroExch.PDDoc")

Set PDDoc = AVDoc.GetPDDoc

'****** SEND KEYSTROKES TO ACROBAT TO MANIPULATE OCR DIALOG BOX ******

'****** TABS take you to the 'ok' button and SendKeys sends 'ENTER' ******

SendKeys "{TAB 7}"

DoEvents

SendKeys "{ENTER}", True

AcroApp.MenuItemExecute ("Cpt:CapturePages")

PDDoc.Save 1, strFilePath

Set AcroApp = Nothing

End Function