troubleshooting Question

Can a PDF File's Protected View be Removed with VBA Code

Avatar of gdunn59
gdunn59 asked on
Microsoft AccessAdobe FlashVBA
6 Comments1 Solution1477 ViewsLast Modified:
I have some VBA Code in MS Access that grabs a PDF from an email in Outlook.  When I open these PDFs they show that they are in "Protected View" mode.   Next to this message is a "Enable All Features" button that removes the protection.

My VBA code loops through the PDF document and grabs the text from each field and then puts it in a table in Access.  Because the PDFs are protected, it's unable to grab any of the text from the PDF.

Is there a way with VBA Code to remove the "Protected View" mode from the PDFs once it is open, and prior to my VBA Code running?

Here is my VBA code:
Function GetFileText(strFilePath As String) As String
'IAC objects
Dim gPdDoc As Acrobat.CAcroPDDoc
Dim gAvDoc As Acrobat.CAcroAVDoc

'variables
'Dim gPDFPath As String
Dim sName As String
Dim lNum As Integer

'Initialize Acrobat by creating App object
Set gApp = CreateObject("AcroExch.App")

'Set AVDoc object
'gAvDoc = gApp.GetActiveDoc
Set gAvDoc = CreateObject("AcroExch.AVDoc")

' open the PDF
If gAvDoc.Open(strFilePath, "") Then
    gApp.Show
    'Set PDDoc object and get some data
    Set gPdDoc = gAvDoc.GetPDDoc
    lNum = gPdDoc.GetNumPages
    sName = gPdDoc.GetFileName
    GetFileText = Acro_GetPageText(strFilePath, gPdDoc, gAvDoc)
End If

End Function
Thanks,
gdunn59
ASKER CERTIFIED SOLUTION
John Tsioumpris
IT Supervisor
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros