Error using MODI "Object hasn't been initialized"

ddobier

New member
Local time
Today, 17:28
Joined
Jan 9, 2009
Messages
4
I created a simple app that opens a tif image, performs OCR on it, and displays the ocr results to a textbox on an access form. It works on my machine but not on my coworkers. We both have access 2003 and I can set the reference to the microsoft office document imagining piece on either machine. I've tried using the same tif image on both machines but it just doesn't run on this one machine. Any thoughts would be greatly appreciated. It errors on this line: (Doc1.Images(0).OCR ). Here's the code:

Dim inputFile As String
Dim strRecText As String
Dim Doc1 As MODI.Document
Dim imagecounter As Integer
inputFile = Me.txtFileName
strRecText = ""
Me.txtOcrData = ""
Set Doc1 = New MODI.Document
Doc1.Create (inputFile)
Doc1.Images(0).OCR ' this will ocr all pages of a multi-page tiff file
Doc1.Save ' this will save the deskewed reoriented images, and the OCR text, back to the inputFile

For imagecounter = 0 To (Doc1.Images.Count - 1) ' work your way through each page of results
strRecText = strRecText & Doc1.Images(imagecounter).Layout.Text ' this puts the ocr results into a string
Next

Me.txtOcrData = strRecText
'File.AppendAllText("C:\test\testmodi.txt", strRecText) ' write the OCR file out to disk

Doc1.Close ' clean up
Set Doc1 = Nothing
 
Is it possible the DLL is not registered?

On the Run Line do something like this:

RegSvr32.Exe "C:\Program Files\Common Files\Microsoft Shared\MODI\11.0\MDIVWCTL.DLL"
 
Last edited:
Thanks for the thought. I tried that already with no luck. I also removed the reference to the modi library from the bad machine and then readded it without any errors. So frustrating especially since I was only going to spend 20 minutes creating a "quick" utility for my coworker and it's now turning into hours. The beauty of the software business I guess.

Thanks again for replying.

Darren
 
Hmmm. I looked at the problematic workstation where the modi files are and it only has six files there. On my machine I have 39. I'm guessing this may be the issue. I'm going to have it reinstalled on her machine to see if that fixes it. Thanks for the great responses.
 
You may also want to try manually running the MODI app to see if it has been installed properly.
 

Users who are viewing this thread

Back
Top Bottom