1

I'm trying to programmatically OCR batches of files. Microsoft Office Document Imaging (MODI) includes a decent OCR that can be controlled with VBA, but I'm running into a strange error.

Microsoft provides the following code:

Sub TestOCR()
Dim miDoc As MODI.Document
Set miDoc = New MODI.Document
miDoc.Create "C:\document1.tif"
Screen.MousePointer = vbHourglass
miDoc.OCR
Screen.MousePointer = vbDefault
Set miDoc = Nothing
End Sub

At miDoc.OCR, Access will suddenly close without warning.

Googling has shown that MODI stopped being included after Office 2007, but it's possible to install it manually. It was already on my (work) computer, and I'm able to OCR things manually. I'm also able to view the MODI 12.0 object library in Access. A coworker with Office 2003 tried running the code and it caused the same error.

Does anyone know what's causing this code to fail? I'm definitely at a loss here.

pnuts
  • 58,317
  • 11
  • 87
  • 139

0 Answers0