Dim AdobeApp As String
Dim AdobeFile As String
Dim StartAdobe
AdobeApp = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"
AdobeFile = "M:\test\car1\Unit114\Combined M641-1T14.pdf"
StartAdobe = Shell("" & AdobeApp & " " & AdobeFile & "", 1)
Application.OnTime Now + TimeValue("00:00:05"), "FirstStep"
End Sub
Private Sub FirstStep()
SendKeys ("^a")
SendKeys ("^c")
Application.OnTime Now + TimeValue("00:00:10"), "SecondStep"
End Sub
Private Sub SecondStep()
AppActivate "Microsoft Excel"
Range("A1").Activate
SendKeys ("^v")
End Sub
StartAdobe = Shell(Q(AdobeApp) & " " & Q(AdobeFile), 1)
Private Function Q(text As String)
Q = Chr(34) & text & Chr(34)
End Function
Where have you put the code? That error can occur if the code, specifically the OnTime macros, is in a sheet module. The easiest solution is to put all the code in a standard module.Thank you - I am able to open the PDF now.
However, I am getting a error message that says --- """Cannot run the macro "C:\users\myoung\documents\copy pdf to excel.xlsm'!FirstStep'. The macro may not be available in this workbook or all macros may be disabled"""
Do you know why?
AppActivate "Microsoft Excel"