"Can not create ActiveX Component"
-
Hello I am testing a VB 2008 application which will allow the user to select a PDF, add a pre-defined annotation, and save the file back to disk. That's all I want from the program at the moment. However, I get a runtime error when I try to create the AcroExch.App object so that my application can interact with Acrobat. I get the "Can not create ActiveX Component" exception handler on the screen when I try to debug or launch my application. Does anyone know what this means? I bolded the offending code below. Thanks! :)
Public Class Form1
Dim gApp As Acrobat.CAcroAppPrivate Sub Form\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load **gApp = CreateObject("AcroExch.App")** End Sub Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim pdDoc As Acrobat.CAcroPDDoc Dim page As Acrobat.CAcroPDPage Dim jso As Object Dim path As String Dim point(1) As Integer Dim popupRect(3) As Integer Dim pageRect As Object Dim annot As Object Dim props As Object OpenFileDialog1.ShowDialog() path = OpenFileDialog1.FileName pdDoc = CreateObject("AcroExch.PDDoc") If pdDoc.Open(path) Then jso = pdDoc.GetJSObject If Not jso Is Nothing Then ' Get size for page 0 and setup arrays page = pdDoc.AcquirePage(0) pageRect = page.GetSize point(0) = 0 point(1) = pageRect.y popupRect(0) = 0 popupRect(1) = pageRect.y - 100 popupRect(2) = 200 popupRect(3) = pageRect.y ' Create a new text annot annot = jso.AddAnnot props = annot.getProps props.Type = "Text" annot.setProps(props) ' Fill in a few fields props = annot.getProps props.page = 0 props.point = point props.popupRect = popupRect props.author = "Rob McAfee" props.noteIcon = "Comment" props.strokeColor = jso.Color.red props.Contents = "I added this comment from Visual Basic!" annot.setProps(props) pdDoc.Close() MsgBox("Annotation added to " &
-
Hello I am testing a VB 2008 application which will allow the user to select a PDF, add a pre-defined annotation, and save the file back to disk. That's all I want from the program at the moment. However, I get a runtime error when I try to create the AcroExch.App object so that my application can interact with Acrobat. I get the "Can not create ActiveX Component" exception handler on the screen when I try to debug or launch my application. Does anyone know what this means? I bolded the offending code below. Thanks! :)
Public Class Form1
Dim gApp As Acrobat.CAcroAppPrivate Sub Form\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load **gApp = CreateObject("AcroExch.App")** End Sub Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim pdDoc As Acrobat.CAcroPDDoc Dim page As Acrobat.CAcroPDPage Dim jso As Object Dim path As String Dim point(1) As Integer Dim popupRect(3) As Integer Dim pageRect As Object Dim annot As Object Dim props As Object OpenFileDialog1.ShowDialog() path = OpenFileDialog1.FileName pdDoc = CreateObject("AcroExch.PDDoc") If pdDoc.Open(path) Then jso = pdDoc.GetJSObject If Not jso Is Nothing Then ' Get size for page 0 and setup arrays page = pdDoc.AcquirePage(0) pageRect = page.GetSize point(0) = 0 point(1) = pageRect.y popupRect(0) = 0 popupRect(1) = pageRect.y - 100 popupRect(2) = 200 popupRect(3) = pageRect.y ' Create a new text annot annot = jso.AddAnnot props = annot.getProps props.Type = "Text" annot.setProps(props) ' Fill in a few fields props = annot.getProps props.page = 0 props.point = point props.popupRect = popupRect props.author = "Rob McAfee" props.noteIcon = "Comment" props.strokeColor = jso.Color.red props.Contents = "I added this comment from Visual Basic!" annot.setProps(props) pdDoc.Close() MsgBox("Annotation added to " &
Do you have either Adobe Acrobat Standard or Professional editions installed?? If not, you dead in the water.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Do you have either Adobe Acrobat Standard or Professional editions installed?? If not, you dead in the water.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Ahhh. I have only the Reader 8.0 on the machine I am testing. Thanks. :)