title: There was an error opening this document. Invalid action object
body: <p>I’m writing a Sub Routine in VBA to display the amount of pages in a PDF document.  Here is my code (from my module):</p>
  
  <pre><code>Sub PDF_Num_Pages()
     Dim tCount As Long
     Dim objAVDoc As New AcroAVDoc
     Dim objPDDoc As New AcroPDDoc
     Dim objPage As AcroPDPage
     Dim objSelection As AcroPDTextSelect
     Dim objHighlight As AcroHiliteList
     Dim pageNum As Long
     Dim strText As String
  
     objAVDoc.Open "C:\&lt;path to my file&gt;\simple1.pdf", ""
     Set objPDDoc = objAVDoc.GetPDDoc
     MsgBox objPDDoc.GetNumPages()
  
  End Sub
  </code></pre>
  
  <p>When I run the script, Adobe Acrobat Reader opens.  Then an error appears from Adobe Acrobat:<br>
  <code>There was an error opening this document. Invalid action object.</code></p>
  
  <p>I click on OK.  The box disappears.  </p>
  
  <p>Then in Excel, my message box appears, displaying a -1.  </p>
  
  <p>The PDF is 1 page in length, and so it should display a 1.  </p>
  
  <p>In the <code>Tools-&gt;References</code> I have the <code>Adobe Acrobat 10.0 Type Library</code> checked.  </p>
  
  <p>In my Adobe Acrobat Document (simple1) I enabled the security features.  When I double click on it, I don’t get the "Enable All Features" choice, anymore.  It automatically opens.  </p>
  
  <p>What could I be doing wrong?  </p>