I wrote this function in VBA to print pdfs from my database. I wanted to open the pdf file, print, close it without dealing with extra steps. I am using access xp, but saving as 2000 on a XP home laptop. On the Laptop, it works fine. I moved the database file to my pc using access 2000 and xp pro and I get "Runtime error '429', Active x component can't create object". It crashes on the first set = line. I also tried another computer that has access xp and xp home. It crashed too.
I am using Acrobat reader 8.1.2 on all systems. I have "Adobe Acrobat 8.0 type lib." reference on in all systems.
What am I missing?
Public Function PrintPDF(strFileName As String)
Dim avdoc As Object
Dim app As Object
Dim pddoc As Object
Dim x As Long
Set app = CreateObject("AcroExch.App")
Set avdoc = CreateObject("acroexch.avdoc")
avdoc.Open strFileName, "temp title"
If (avdoc.IsValid = True) Then
Set pddoc = avdoc.GetPDDoc()
x = .GetNumPages
x = x - 1
.PrintPages 0, x, 1, 1, 1