gdunn59
asked on
Object Variable or Block Variable Not Set - Adobe Acrobat
I have the following code. When I run it, I'm getting the following error on Line 32:
Object Variable or Block Variable Not Set
Thanks,
gdunn59
Object Variable or Block Variable Not Set
Function Acro_GetPageText(pdoc As AcroPDDoc, Optional nPage As Long = -1) As String
Dim r As New AcroRect
Dim ts As Acrobat.AcroPDTextSelect
Dim pdPage As Acrobat.AcroPDPage
Dim pPoint As Acrobat.AcroPoint
Dim nTextLoop As Long
Dim nPageLoop As Long
Dim strOut As String
Dim nPageStart As Long
Dim nPageEnd As Long
If nPage = -1 Then 'all pages
nPageStart = 0
nPageEnd = pdoc.GetNumPages - 1
Else
nPageStart = nPage
nPageEnd = nPage
End If
For nPageLoop = nPageStart To nPageEnd
Set pdPage = pdoc.AcquirePage(nPageLoop)
Set pPoint = pdPage.GetSize
r.Left = 0
r.Top = pPoint.y
r.Bottom = 0
r.Right = pPoint.x
Set ts = pdoc.CreateTextSelect(nPageLoop, r)
For nTextLoop = 0 To ts.GetNumText - 1
strOut = strOut & ts.GetText(nTextLoop)
Next
strOut = strOut & vbCrLf '!NOTE: we are putting a crlf after each page to simulate clipboard copy and paste
ts.Destroy
Next
If Len(strOut) > 3 Then strOut = Left(strOut, Len(strOut) - 2) 'ditch extr crlf from between pages
Acro_GetPageText = strOut
ErrHandler:
Set r = Nothing
Set ts = Nothing
Set pdPage = Nothing
Set pPoint = Nothing
Call ErrorHandler(err, "Acro_GetPageText")
End Function
Thanks,
gdunn59
Line 32 is dependent on this line:
Set ts = pdoc.CreateTextSelect(nPag eLoop, r)
If the call to CreateTextSelect does not return a value, then the value of "ts" would be nothing, and you'd get that error.
I would assume you have the reference set, otherwise you'd bomb out before this. However, as Jamie suggests, you should be sure that you have the Adobe reference in your system. Also be aware that anyone who will use this application must have the full version of Adobe installed, otherwise your code will fail.
In cases like this, it's always a good idea to create a Breakpoint in your code on a line above where the problem lies, then execute that code sample and step through. Here's a good article on tracking down errors using a Breakpoint:
https://www.experts-exchange.com/articles/6573/Debugging-Part-2.html
Set ts = pdoc.CreateTextSelect(nPag
If the call to CreateTextSelect does not return a value, then the value of "ts" would be nothing, and you'd get that error.
I would assume you have the reference set, otherwise you'd bomb out before this. However, as Jamie suggests, you should be sure that you have the Adobe reference in your system. Also be aware that anyone who will use this application must have the full version of Adobe installed, otherwise your code will fail.
In cases like this, it's always a good idea to create a Breakpoint in your code on a line above where the problem lies, then execute that code sample and step through. Here's a good article on tracking down errors using a Breakpoint:
https://www.experts-exchange.com/articles/6573/Debugging-Part-2.html
Scotts spot on with that and so I would add add this after the Set ts line to deal with that condition:
I managed to get the code to compile (one I added the Adobe reference) but could't repro your error as I don't know how your creating the object which is passed to the function as pdoc.
Set ts = pdoc.CreateTextSelect(nPageLoop, r)
If ts Is Nothing Then
MsgBox "Couldn't create text selection in the document.", vbCritical + vbOKOnly, "Error"
Exit Function
End If
I managed to get the code to compile (one I added the Adobe reference) but could't repro your error as I don't know how your creating the object which is passed to the function as pdoc.
Also, anytime you deal with incoming objects, it's a good idea to verify them before use:
If pdoc In Nothing Then
Msgbox("No Document Provided")
Exit Function
End If
If pdoc In Nothing Then
Msgbox("No Document Provided")
Exit Function
End If
ASKER
This database was recently converted to MS Access 2016 and upgraded to Windows 10 Operating System. Prior to the conversion and upgrade, everything worked fine.
Here is the code for the pdoc:
Here is some of the other code that is being used:
I didn't write this code, a former employee did, so I'm' not 100% sure how it all works yet.
Still getting the error "Object Variable or Block Variable Not Set" on Line 32 of the code of my first posting.
Thanks,
gdunn
Here is the code for the pdoc:
Function GetFileText(strFilePath As String) As String
Dim doc As New AcroAVDoc
Dim pdoc As New AcroPDDoc
Dim nAttemptCount As Long
doc.Open strFilePath, ""
Set pdoc = doc.GetPDDoc
GetFileText = Acro_GetPageText(pdoc)
pdoc.Close
doc.Close 1
ErrHandler:
Set pdoc = Nothing
Set doc = Nothing
End Function
Here is some of the other code that is being used:
Function GetAppPath() As String
'return the db's path who is calling it; path will end with \
GetAppPath = CurrentProject.Path
If Right(GetAppPath, 1) <> "\" Then GetAppPath = GetAppPath & "\"
End Function
Function ShellFile(strFilePath As String, Optional strOperation As String = "open", Optional strParameters As String = "", Optional strDirectory As String, Optional nShowCmd As Long = 1) As Long
ShellFile = ShellExecute(Application.hWndAccessApp, strOperation, strFilePath, strParameters, strDirectory, 1)
End Function
Function FindFiles(strStartDir As String, strResults() As String) As Long
On Error GoTo ErrHandler
Dim wfd As WIN32_FIND_DATA
Dim nFind As Long
Dim strFilePath As String
ReDim strResults(0) '0 will not be used
nFind = FindFirstFile(strStartDir, wfd) 'api call
strFilePath = Left(wfd.cFileName, InStr(1, wfd.cFileName, Chr(0)) - 1)
If strFilePath <> "." And strFilePath <> ".." And strFilePath <> "" Then
ReDim Preserve strResults(UBound(strResults) + 1)
strResults(UBound(strResults)) = strFilePath
End If
Do While FindNextFile(nFind, wfd)
strFilePath = Left(wfd.cFileName, InStr(1, wfd.cFileName, Chr(0)) - 1)
If strFilePath <> "." And strFilePath <> ".." And strFilePath <> "" Then
ReDim Preserve strResults(UBound(strResults) + 1)
strResults(UBound(strResults)) = strFilePath
End If
Loop
ErrHandler:
FindClose nFind
FindFiles = ErrorHandler(err, "FindFiles")
End Function
Function UserHasFolderWriteAccess(strFolder As String) As Boolean 'return whether or not a user can read and write to the given folder
On Error GoTo ErrHandler
Dim outFile As Long
Dim strFilePath As String
If Right(strFolder, 1) <> "\" Then strFolder = strFolder & "\"
If UserHasFolderReadAccess(strFolder) = False Then 'if they dont have read then they probly dont have write, eh?
UserHasFolderWriteAccess = False
Exit Function
End If
strFilePath = strFolder & GetUName & "_test_" & Format(Now, "yymmddhhnnss") & ".txt" 'trying to assure unique name with the current date/time
outFile = FreeFile
Open strFilePath For Output As #outFile
Print #outFile, "test"
Close #outFile
Kill strFilePath
UserHasFolderWriteAccess = True
Exit Function
ErrHandler:
Close #outFile
UserHasFolderWriteAccess = False
End Function
I didn't write this code, a former employee did, so I'm' not 100% sure how it all works yet.
Still getting the error "Object Variable or Block Variable Not Set" on Line 32 of the code of my first posting.
Thanks,
gdunn
Have you put any code in place as suggested by myself or Jamie? Those two code blocks would help you determine pretty quickly in the "ts" and "pdoc" objects are valid, but if you're not going to follow our advice, then it's impossible to help you ...
Have you stepped through the code using the debugging techniques I linked to earlier? Using this technique, along with the Immediate window, you can determine pretty quickly if those objects are being created.
Have you stepped through the code using the debugging techniques I linked to earlier? Using this technique, along with the Immediate window, you can determine pretty quickly if those objects are being created.
ASKER
Scott,
It's not that I don't want to follow your guys advice, I didn't have time yet to do so, also I just posted all the other code because Jamie posted the following:
"I managed to get the code to compile (one I added the Adobe reference) but could't repro your error as I don't know how your creating the object which is passed to the function as pdoc."
I did put in the If Statement regarding the "ts" variable, and it evaluates to "Nothing".
I also put the variables in the immediate window while stepping through the code, and here is what I got:
As I mentioned in one of my posts, this database worked fine until it was converted to MS Access 2016 and the operating system was upgraded to Windows 10. So I still think it has something to do with how Adobe Acrobat works with Access 2016 and Windows 10. I also made sure that I had the correct libraries selected for Adobe in the References.
Thanks,
gdunn59
C--Users-msc551-Desktop-AdobeReferen.jpg
It's not that I don't want to follow your guys advice, I didn't have time yet to do so, also I just posted all the other code because Jamie posted the following:
"I managed to get the code to compile (one I added the Adobe reference) but could't repro your error as I don't know how your creating the object which is passed to the function as pdoc."
I did put in the If Statement regarding the "ts" variable, and it evaluates to "Nothing".
I also put the variables in the immediate window while stepping through the code, and here is what I got:
Variable nPageLoop = 0
Variable nPageStart = 0
Variable nPageEnd = 0
Variable pdPage gives the following error:
Run-time error '438':
Object doesn't support this property or method
Variable pPoint gives the following error:
Run-time error '438':
Object doesn't support this property or method
If I put my cursor over pPoint where it shows r.Top = pPoint.y it shows "792"
If I put my cursor over pPoint where it shows r.Right = pPoint.x it shows "612"
Set ts is nothing evaluates to "Nothing"
In the Immediate Window when I put in the variable "ts" the following error occurs:
Run-time error '91':
Object Variable or with Block not set
I click OK, then the MsgBox appears showing "Couldn't create text selection in the document", and it Exits the Function.
In the Immediate Window the variable "pdoc" produces the following error:
Run-time error '438':
Object doesn't support this property or method
As I mentioned in one of my posts, this database worked fine until it was converted to MS Access 2016 and the operating system was upgraded to Windows 10. So I still think it has something to do with how Adobe Acrobat works with Access 2016 and Windows 10. I also made sure that I had the correct libraries selected for Adobe in the References.
Thanks,
gdunn59
C--Users-msc551-Desktop-AdobeReferen.jpg
From that, it would seem that either Adobe would not be correctly installed, or another of your references are not correctly installed.
ASKER
I sent an attachment showing what references I have selected. Not sure what else to include for Adobe.
Any suggestions?
Thanks,
gdunn59
Any suggestions?
Thanks,
gdunn59
Could it be that Scott? I have the Adobe Type Library set and the code compiles. It wouldn't even compile when using Early Binding if the reference(s) are not correct?
@gdunn59 You mention upgrading. Have you changed from 32 bit Office to 64 bit? Are you using WinAPIs (search your project for "Declare"? If so, you may need to make some x64 changes like declaring APIs as PtrSafe and Long -> LongPtr.
@gdunn59 You mention upgrading. Have you changed from 32 bit Office to 64 bit? Are you using WinAPIs (search your project for "Declare"? If so, you may need to make some x64 changes like declaring APIs as PtrSafe and Long -> LongPtr.
I did not say the references are not correct, but instead that they may not be properly installed. The errors reported in the last post by GDunn seem to indicate the objects are not being created. Assuming the reference is the right one, the first thought for me was it was installed correctly, or had become corrupt.
The code very likely would not compile in that scenario, but we have no indication that GDunn has tried to compile the code. It would be worthwhile to do that, of course.
The bottom line is this - those objects are not being created (or not being created properly).
The code very likely would not compile in that scenario, but we have no indication that GDunn has tried to compile the code. It would be worthwhile to do that, of course.
this database worked fine until it was converted to MS Access 2016 and the operating system was upgraded to Windows 10.New iterations of Access always are more particular about code correctness than older ones. Not to say yours is not correct - I don't use Adobe, so don't know - but assuming things were right in the older version does not mean they are right in the newer versions.
The bottom line is this - those objects are not being created (or not being created properly).
ASKER
Scott,
Yes, I have compiled the code and I get no errors. That's what is so strange.
Thanks,
gdunn59
Yes, I have compiled the code and I get no errors. That's what is so strange.
Thanks,
gdunn59
ASKER
I've never done VBA Code before utilizing Adobe. As I mentioned before I took over this project from a former employee who wrote the code, and it didn't produce any errors until the upgrades.
Thanks,
gdunn59
Thanks,
gdunn59
ASKER
I have changed all of the appropriate declarations to PtrSafe and LongPtr, and still the same issue.
ASKER
I'm going to open another question and target Adobe as the main Topic, and see if I can get any assistance.
I've tried everything that I can think of.
Thanks everyone for your assistance.
gdunn59
I've tried everything that I can think of.
Thanks everyone for your assistance.
gdunn59
There is not such thing as a "main topic". You've already got Adobe in the topics, so it's already in that topic, and EE doesn't allow you to post duplicates.
Here's the troubleshooting steps you should take, in my opinion:
1. Set a breakpoint at the top of the module.
2. Execute the process that will run that module
3. On each line, check the values of your Adobe objects (ts, pdPage, pPoint, and pdoc).
Let us know when you have an unexpected value, like when you think "pdPage" should be something, but is not.
Here's the troubleshooting steps you should take, in my opinion:
1. Set a breakpoint at the top of the module.
2. Execute the process that will run that module
3. On each line, check the values of your Adobe objects (ts, pdPage, pPoint, and pdoc).
Let us know when you have an unexpected value, like when you think "pdPage" should be something, but is not.
ASKER
Scott,
Sorry, I just posted.
I thought if I posted with Adobe as the first topic, that I might get more hits. I guess I don't fully understand how it works here on EE.
Thanks,
gdunn59
Sorry, I just posted.
I thought if I posted with Adobe as the first topic, that I might get more hits. I guess I don't fully understand how it works here on EE.
Thanks,
gdunn59
ASKER
Scott,
I've already done all the troubleshooting steps that you suggested.
Thanks,
gdunn59
I've already done all the troubleshooting steps that you suggested.
Thanks,
gdunn59
ASKER
HELP PLEASE!!!!
Sounds to me like you need to have someone with more experience review this. Perhaps a Live or Gigs session would help.
ASKER
Scott,
How do I go about that?
Thanks,
gdunn59
How do I go about that?
Thanks,
gdunn59
EE has the Live feature, where you pay in 15 minute "chunks". The Gigs feature is similar, except you accept proposals and such for your issue (which is probably not the way to do this one).
Or you can hire one of the Experts directly. Many of the top Experts are available for hire. Check their profiles to see if they are accepting solicitation.
Or you can hire one of the Experts directly. Many of the top Experts are available for hire. Check their profiles to see if they are accepting solicitation.
ASKER
OMG this thing is so flaky. I redid the code (see attached), but it ran the first time and then when it looped to run again, I get the run-time error 91 Object Variable or Block Variable Not Set again. Now, it won't work at all again.
I was searching on the internet and saw that tons of people were having this same issue where it would run fine the first time, but then the second time around they get the run-time error 91: Object Variable or Block Variable Not Set.
Here is the code I'm using now:
The error is happening on line 65 of the code. It has something to do with the "gPdDoc" variable, because when I step through the code in the "Function GetFileText", the "gPdDoc" variable shows a value, but once it gets to the "Function Acro_GetPageText", the Line of Code "Set ts = gPdDoc.CreateTextSelect(nP ageLoop, r)" shows "Nothing".
Do I need to set some other variables to "Nothing" somewhere in the code?
Thanks,
gdunn59
I was searching on the internet and saw that tons of people were having this same issue where it would run fine the first time, but then the second time around they get the run-time error 91: Object Variable or Block Variable Not Set.
Here is the code I'm using now:
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")
' show Acrobat
gApp.Show
'Set AVDoc object
'gAvDoc = gApp.GetActiveDoc
Set gAvDoc = CreateObject("AcroExch.AVDoc")
' open the PDF
If gAvDoc.Open(strFilePath, "") Then
'Set PDDoc object and get some data
Set gPdDoc = gAvDoc.GetPDDoc()
lNum = gPdDoc.GetNumPages()
sName = gPdDoc.GetFileName()
End If
GetFileText = Acro_GetPageText(gPdDoc, gAvDoc)
End Function
Function Acro_GetPageText(gPdDoc As Acrobat.CAcroPDDoc, Optional nPage As Long = -1) As String
Dim r As New Acrobat.AcroRect
Dim pdPage As Acrobat.CAcroPDPage
Dim ts As Acrobat.CAcroPDTextSelect
Dim pPoint As Acrobat.CAcroPoint
Dim nTextLoop As Long
Dim nPageLoop As Long
Dim strOut As String
Dim nPageStart As Long
Dim nPageEnd As Long
If nPage = -1 Then 'all pages
nPageStart = 0
nPageEnd = gPdDoc.GetNumPages - 1
Else
nPageStart = nPage
nPageEnd = nPage
End If
For nPageLoop = nPageStart To nPageEnd
Set pdPage = gPdDoc.AcquirePage(nPageLoop)
Set pPoint = pdPage.GetSize
r.Left = 0
r.Top = pPoint.y
r.Bottom = 0
r.Right = pPoint.x
Set ts = gPdDoc.CreateTextSelect(nPageLoop, r)
For nTextLoop = 0 To ts.GetNumText - 1
strOut = strOut & ts.GetText(nTextLoop)
Next
strOut = strOut & vbCrLf '!NOTE: we are putting a crlf after each page to simulate clipboard copy and paste
ts.Destroy
Next
If Len(strOut) > 3 Then strOut = Left(strOut, Len(strOut) - 2) 'ditch extr crlf from between pages
Acro_GetPageText = strOut
ErrHandler:
Set r = Nothing
Set ts = Nothing
Set pdPage = Nothing
Set pPoint = Nothing
Set gPdDoc = Nothing
Set gAvDoc = Nothing
Call ErrorHandler(err, "Acro_GetPageText")
End Function
The error is happening on line 65 of the code. It has something to do with the "gPdDoc" variable, because when I step through the code in the "Function GetFileText", the "gPdDoc" variable shows a value, but once it gets to the "Function Acro_GetPageText", the Line of Code "Set ts = gPdDoc.CreateTextSelect(nP
Do I need to set some other variables to "Nothing" somewhere in the code?
Thanks,
gdunn59
Is gPdDoc being set to nothing in another procedure? That would explain running once only in a loop before raising an error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Scott McDaniel,
I just tried what you suggested, and still get the same error on the same Line of Code.
Thanks,
gdunn59
I just tried what you suggested, and still get the same error on the same Line of 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")
' show Acrobat
gApp.Show
'Set AVDoc object
'gAvDoc = gApp.GetActiveDoc
Set gAvDoc = CreateObject("AcroExch.AVDoc")
' open the PDF
If gAvDoc.Open(strFilePath, "") Then
'Set PDDoc object and get some data
Set gPdDoc = gAvDoc.GetPDDoc()
lNum = gPdDoc.GetNumPages()
sName = gPdDoc.GetFileName()
GetFileText = Acro_GetPageText(gPdDoc, gAvDoc)
End If
'GetFileText = Acro_GetPageText(gPdDoc)
End Function
Function Acro_GetPageText(gPdDoc As Acrobat.CAcroPDDoc, gAvDoc As Acrobat.AcroAVDoc, Optional nPage As Long = -1) As String
Dim r As New Acrobat.AcroRect
Dim pdPage As Acrobat.CAcroPDPage
Dim ts As Acrobat.CAcroPDTextSelect
Dim pPoint As Acrobat.CAcroPoint
Dim nTextLoop As Long
Dim nPageLoop As Long
Dim strOut As String
Dim nPageStart As Long
Dim nPageEnd As Long
If nPage = -1 Then 'all pages
nPageStart = 0
nPageEnd = gPdDoc.GetNumPages - 1
Else
nPageStart = nPage
nPageEnd = nPage
End If
For nPageLoop = nPageStart To nPageEnd
Set pdPage = gPdDoc.AcquirePage(nPageLoop)
Set pPoint = pdPage.GetSize
r.Left = 0
r.Top = pPoint.y
r.Bottom = 0
r.Right = pPoint.x
Set ts = gPdDoc.CreateTextSelect(nPageLoop, r)
For nTextLoop = 0 To ts.GetNumText - 1
strOut = strOut & ts.GetText(nTextLoop)
Next
strOut = strOut & vbCrLf '!NOTE: we are putting a crlf after each page to simulate clipboard copy and paste
ts.Destroy
Next
If Len(strOut) > 3 Then strOut = Left(strOut, Len(strOut) - 2) 'ditch extr crlf from between pages
Acro_GetPageText = strOut
ErrHandler:
Set gPdDoc = Nothing
Set gAvDoc = Nothing
Set pdPage = Nothing
Set pPoint = Nothing
Set ts = Nothing
Call ErrorHandler(err, "Acro_GetPageText")
End Function
Thanks,
gdunn59
ASKER
As the code is running, if I put the variable strFilePath in the Immediate Window, it shows the following:
"H:\MS Access Development Projects\Systems\COGCC Inspection System\MS Access Version 2016\_temp_\insp_674103953 .pdf"
When I check my email, the first email has that particular PDF attached. When I open that PDF, there are 3 pages in it.
It's like it doesn't acknowledge that the PDF is open, because lNum shows that there is 1 page, when there is actually 3 pages in the PDF.
Also, I noticed that when I'm stepping through the Code, and it gets to Line 15 of the Code (gApp.Show), I have minimized at the bottom of my screen the PDF Acrobat Pro DC dialog box (I've attached a document that has the screen shot of what is minimized). So it appears that is what the code is looking at that shows the variable lNum = 1.
Any thoughts???
Thanks,
gdunn59
H--MS-Access-Development-Projects-Sy.jpg
"H:\MS Access Development Projects\Systems\COGCC Inspection System\MS Access Version 2016\_temp_\insp_674103953
When I check my email, the first email has that particular PDF attached. When I open that PDF, there are 3 pages in it.
It's like it doesn't acknowledge that the PDF is open, because lNum shows that there is 1 page, when there is actually 3 pages in the PDF.
Also, I noticed that when I'm stepping through the Code, and it gets to Line 15 of the Code (gApp.Show), I have minimized at the bottom of my screen the PDF Acrobat Pro DC dialog box (I've attached a document that has the screen shot of what is minimized). So it appears that is what the code is looking at that shows the variable lNum = 1.
Any thoughts???
Thanks,
gdunn59
H--MS-Access-Development-Projects-Sy.jpg
ASKER
I just commented out Line 15 of the code (gApp.Show), so it no longer minimizes the PDF Acrobat Pro DC dialog box, but the variable lNum still shows "1".
Thanks,
gdunn59
Thanks,
gdunn59
ASKER
When stepping through the code of the Function Acro_GetPageText, the nPageStart and nPageEnd show "0".
ASKER
I added gApp.Show right after the If Statement on Line 3 of the Code, and now the actual PDF is minimized, but it still doesn't recognize the correct number of pages in the PDF.
' 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
ASKER
Ok. I think I figured out what the problem is, but not sure how to get the VBA code to change the it.
When the PDF opens, there is security on the PDF. It shows "Protected View: this file originated from a potentially unsafe location, and most features have been disabled to avoid potential security risks". There is a button next to it that says "Enable All Features". When I click on the button and then resave the file without the Protected View, the code works.
I just need to figure out how to get the code to review the Protected View.
Thanks,
gdunn59
When the PDF opens, there is security on the PDF. It shows "Protected View: this file originated from a potentially unsafe location, and most features have been disabled to avoid potential security risks". There is a button next to it that says "Enable All Features". When I click on the button and then resave the file without the Protected View, the code works.
I just need to figure out how to get the code to review the Protected View.
Thanks,
gdunn59
Secondly, are you able to provide example input to the function for the pdoc object and an example call to the function as I can't see how you're passing the variable Type AcroPDDoc?