Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. "Can not create ActiveX Component"

"Can not create ActiveX Component"

Scheduled Pinned Locked Moved Visual Basic
comtestingdebuggingbeta-testing
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Harold_Wishes
    wrote on last edited by
    #1

    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.CAcroApp

    Private 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 " &
    
    D 1 Reply Last reply
    0
    • H Harold_Wishes

      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.CAcroApp

      Private 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 " &
      
      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      H 1 Reply Last reply
      0
      • D Dave Kreskowiak

        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

        H Offline
        H Offline
        Harold_Wishes
        wrote on last edited by
        #3

        Ahhh. I have only the Reader 8.0 on the machine I am testing. Thanks. :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups