6 Replies Latest reply on Dec 29, 2014 8:09 AM by MaxCO2012

    Excel VBA to JS: How does one pass rectangle coordinates to a JS function.

    MaxCO2012 Level 1

      I have an Excel VBA sub that calls a folder level JS function and I'm trying to pass a set of rectangle coordinates.


      This is the VBA code:


      Sub BarcodeDoc_PDF417(pdfFileName As String)

          Dim AVDoc As Acrobat.CAcroAVDoc

          Dim PDDoc As Acrobat.CAcroPDDoc

          Dim myApp As Acrobat.CAcroApp

          Dim jso As Object

          Dim bcTmpFile As String

              bcTmpFile = "C:\Temp\bcTmpFile.pdf"

              Set myApp = CreateObject("AcroExch.App")

              Set AVDoc = CreateObject("AcroExch.AVDoc")

                  If AVDoc.Open(pdfFileName, "") Then

                      Set PDDoc = AVDoc.GetPDDoc

                      Set jso = PDDoc.GetJSObject

                          jso.myAdd417Barcode 'This is where the coordinates get passed.

                          PDFSave PDDoc, bcTmpFile



                      Set AVDoc = Nothing

                      Set jso = Nothing

                      Set PDDoc = Nothing

                      Set myApp = Nothing


                      MsgBox "Sub: BarcodeDoc_PDF417. Document not found:" & vbCrLf & vbCrLf & pdfFileName

                  End If

      End Sub


      This is the folder level JS script:


      function myAdd417Barcode(myCoords)


      //The line below is just for testing. Will come out once I can pass the coords in from my VBA sub.

      //var myCoords = [324, 756, 540, 720];

      InsertPDF417Barcode(this, myCoords);



      I've tried to pass the coords as a string and an array, both to no avail. Any ideas?