Copy link to clipboard
Copied
Hi.
I am finding the word I want using Excel VBA.
There are about 530 pages in my PDF file.
After processing about 400 pages, the error message "Microsoft Excel is waiting for another application to complete an OLE action. " always displayed from Excel, and Acrobat becomes "Not Responding".
lRet = objAcroAVDoc.Open(PDFPath, "")
lRet = objAcroApp.Show
Set objAcroPDDoc = objAcroAVDoc.GetPDDoc()
Set jso = objAcroPDDoc.GetJSObject
pageNum = objAcroPDDoc.GetNumPages()
For i = 0 To pageNum - 1
wordNum = jso.getPageNumWords(i)
For j = 0 To wordNum - 1
wordStr = jso.getPageNthWord(i, j, False)
If wordStr = MyFindWord Then
' Do some processing
end if
next
next
My PC : Windows11
Acrobat Pro Version: 2024.002.21005 64bit
Excel : 365
I tried the following, but it didn't change anything.
1. Reinstall Acrobat
2. Repair Acrobat
3. Restart my PC
4. Turn off "Enable Protected Mode at startup" and "Enable Enhanced Security"
5. Delete thumbnails in C:\Users\User name\AppData\LocalLow\Adobe\Acrobat\DC\ConnectorIcons
Please give me some advice.
Copy link to clipboard
Copied
Hi,
Can I check that that is the complete code? if it is then it might be worth adding code in to set all the variables to nothing when you are done with them.
lRet = objAcroAVDoc.Open(PDFPath, "")
lRet = objAcroApp.Show
Set objAcroPDDoc = objAcroAVDoc.GetPDDoc()
Set jso = objAcroPDDoc.GetJSObject
pageNum = objAcroPDDoc.GetNumPages()
For i = 0 To pageNum - 1
wordNum = jso.getPageNumWords(i)
For j = 0 To wordNum - 1
wordStr = jso.getPageNthWord(i, j, False)
If wordStr = MyFindWord Then
' Do some processing
end if
set wordString = Nothing
next
set wordNum = Nothing
next
set pageNum = Nothing
Acrobat and Excel don't seem to handle their objects very well, so you may just be running out of memory.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now