VBA PDF NOT OPEN(ACROBAT DC (PRO))

YSWOO

New Member
Joined
Dec 7, 2020
Messages
10
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
  2. Mobile
Sub CONVERT_PDF_DOC()

Dim aApp As Acrobat.acroapp
Dim av_doc As cacroavdoc
Dim pdf_doc As acropddoc
Dim jso_obj As Object

Dim dfile As String
Dim sfile As String
Dim ext As String

Dim path, file As String

path = "C:\CUSTOMER_ORDER\"
file = Dir(path & "*.pdf")
ext = "xlsx"

Do While file <> ""

dfile = path & Replace(file, ".pdf", "." & ext, 1)

Set aApp = CreateObject("AcroExch.App")
Set av_doc = CreateObject("AcroExch.AVDoc")

If av_doc.Open(file, vbNull) = True Then -> NOT OPEN.. MESSAGE POP UP - "CAN'T FIND FILE INFORMATION"

Set pdf_doc = av_doc.GetPDDoc
Set jso_obj = pdf_doc.GetJSObject

jso_obj.SaveAs dfile, "com.adobe.acrobat." & ext

End If
av_doc.Close flase
aApp.Exit
Set aApp = Nothing
Set av_doc = Nothing

file = Dir()

Loop


End Sub


BUT IF I USE FILE : "C:\CUSTOMER_ORDER\1234.pdf" -> SPECIFIC FILE NAME ->NO PROBLEM!

HOW TO FIGURE IT OUT? FOR REPLACING MULTIPLE PDF FILES IN FOLDER
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try it like
VBA Code:
If av_doc.Open(path & file, vbNull) = True Then
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top