I added this section of code to a function that adds footnotes to individual acrobat files and it does not work printing the files
Can anybody help?
Added --------------------------
----------
----------
----------
----------
--------
  If DoYouWantToSendToPrinter = 6 Then
    Dim appPDF As String
    'The PDf file you want to open
    'Check to see if the file is open already
   Â
    If Not FileLocked(DestPath & DestFileName) Then
      Documents.Open DestPath & DestFileName
    End If
 Â
    'Now that the file is open you can print it
 Â
    'first set the variable to the Adobe program on your computer
 Â
    appPDF = "C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Acrobat.exe"
 Â
    'Now print the file
 Â
    RetVal = Shell(appPDF & "/P" & Chr(34) & DestPath & DestFileName & Chr(34), 0)
 Â
  Else
    MsgBox "no print"
  End If
--------------------------
----------
----------
----------
----------
--
(E) Function with added print section --------------------------
----------
----------
----------
----------
--------
Public Function AddPageNumbers(ByVal SourcePath As String, ByVal SourceFileName As String, ByVal DestPath As String, ByVal DestFileName As String, ByVal FrstPg As Double, ByVal MaxNoPgs As Double, ByVal FileNo As Double, ByVal DoYouWantToSendToPrinter As Integer, ByVal FontSize As Integer, ByVal FontColor As String) As String '07-25-2011, ByVal DoYouWantToInclPathInFtr As Integer) As String
'11-11-2011 Public Function AddPageNumbers(ByVal SourcePath As String, ByVal SourceFileName As String, ByVal DestPath As String, ByVal DestFileName As String, ByVal FrstPg As Double, ByVal MaxNoPgs As Double, ByVal FileNo As Double, ByVal DoYouWantToSendToPrinter As Integer) As String '07-25-2011, ByVal DoYouWantToInclPathInFtr As Integer) As String
  Dim ex1 As String
  Dim App As Object, AVDoc As Object, AcroPDDoc As Object, AForm As Object
  Dim Ret As Long
  Dim sString As String * 255
  Dim PdfPrint As String, numPages As Integer
   Â
  Dim sfile As String
  Dim sText As String
  Dim iFileNum As Integer
 Â
  Dim FileName As String '06-18-2011
 Â
  Set App = CreateObject("Acroexch.app
")
  Set AVDoc = CreateObject("AcroExch.AVD
oc")
  Set AForm = CreateObject("AFormAut.App
") 'from AFormAPI
 Â
  If Right(SourcePath, 1) <> "\" Then SourcePath = SourcePath & "\"
  If Right(DestPath, 1) <> "\" Then DestPath = SourcePath & "\"
 Â
  'FileName = SourcePath & SourceFileName '06-18-2011 - doesn't like symbols in the path either ":" or "\" - need to research
  FileName = SourceFileName '06-18-2011
  booleanresult = AVDoc.Open(SourcePath & SourceFileName, "")
 Â
  If booleanresult = True Then
    App.Show
    Set AcroPDDoc = AVDoc.GetPDDoc
   Â
     'Found Code at this web page
https://forums.adobe.com/thread/721676?start=0&tstart=0
     'Java Script manual at
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf
     'Expert Exchange Question at
https://www.experts-exchange.com/questions/28569754/Editing-an-Acrobat-PDF-file-to-add-page-footers-from-Access-2013.html
      ex1 = " // Set Footer PageNo centered  " & vbLf & "  var Box2Width = 500  " & vbLf & "  for (var p = 0; p < this.numPages; p++)  " & vbLf & "  {  " & vbLf & "   var aRect = this.getPageBox(""Crop"",p
); Â " &Â vbLf &Â " Â Â var TotWidth = aRect[2] - aRect[0] Â " &Â vbLf &Â " Â Â { Â var bStart=(TotWidth/2)-(Box2W
idth/2) Â " &Â vbLf &Â " Â Â Â Â var bEnd=((TotWidth/2)+(Box2Wi
dth/2)) Â " &Â vbLf &Â " Â Â Â Â var fp = this.addField(String(""xft
Page""+p+1
), ""text"", p, [bStart,30,bEnd,15]); Â "Â & vbLf &Â " Â Â Â Â fp.value = """
      ex1 = ex1 & FileName & " -- " & Month(Now) & "/" & Day(Now) & "/" & Year(Now) & " " & Hour(Now) & ":" & Minute(Now)
      ex1 = ex1 & " -- Page: "" + String(p+1)+ ""/"" + this.numPages;  " & vbLf & "     fp.textSize=" & FontSize & "; fp.textcolor = color.red; fp.readonly = true;  " & vbLf & "     fp.alignment=""left"";  " & vbLf & "   }  " & vbLf & "  }  "
    AForm.Fields.ExecuteThisJa
vaScript ex1
  End If
 Â
 Â
  On Error Resume Next
 Â
  AcroPDDoc.Save 1, DestPath & DestFileName
 Â
  numPages = AcroPDDoc.GetNumPages()
 Â
    sfile = DestPath & "Files Printed " & Format$(Now, "YYMMDD") & ".txt"
    sText = IIf(FileNo < 10, "00", IIf(FileNo < 100, "0", "")) & FileNo & " --- " & "Printed " & MaxNoPgs & " of " & IIf(numPages < 10, "00", IIf(numPages < 100, "0", "")) & numPages & " --- " & SourcePath & SourceFileName & " --- " & DestPath & DestFileName
   Â
    If FileNo = 1 Then Kill DestPath & "Files Printed " & Format$(Now, "YYMMDD") & ".txt"
   Â
    iFileNum = FreeFile
    Open sfile For Append As iFileNum
    Write #iFileNum, sText
    Close #iFileNum
 Â
  If MaxNoPgs >= numPages Then
    MaxNoPgs = numPages
  End If
 Â
 Â
  AcroPDDoc.Close
  AVDoc.Close (True)
  App.Exit
 Â
  Ret = FindWindowWild(0, "Adobe*")
  Call GetWindowText(Ret, sString, 255)
 Â
  Ret = FindWindow(vbNullString, sString)
 Â
  PostMessage Ret, WM_CLOSE, CLng(0), CLng(0)
  If DoYouWantToSendToPrinter = 6 Then
    Dim appPDF As String
    'The PDf file you want to open
    'Check to see if the file is open already
   Â
    If Not FileLocked(DestPath & DestFileName) Then
      Documents.Open DestPath & DestFileName
    End If
 Â
    'Now that the file is open you can print it
 Â
    'first set the variable to the Adobe program on your computer
 Â
    appPDF = "C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Acrobat.exe"
 Â
    'Now print the file
 Â
    RetVal = Shell(appPDF & "/P" & Chr(34) & DestPath & DestFileName & Chr(34), 0)
 Â
  Else
    MsgBox "no print"
  End If
  Set AcroPDDoc = Nothing
  Set AVDoc = Nothing
  Set App = Nothing
End Function
On error Resume next
and see what's really going bang!
Looking though, you go to all the trouble to close the file and kill Acrobat, only to Shell out and try to print it. Â Why? Â Why not print the document BEFORE closing &Â killing Acrobat?