Results 1 to 9 of 9

Thread: How to use MODI(MS Office Document Interface) in VB6?

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    How to use MODI(MS Office Document Interface) in VB6?

    I already reference the MODI v12 library and use the following sample code. But when I run the project, it shows me an error at "miDoc.Images(0).OCR" with error message: Object hasn't been initialised and can't be used yet.

    Actually I'm doing a simple project that input a tif file and then perform the OCR process and output the tif content to a text.

    For example the tif file got "ABCDEFGHIJ" then I want to use the MODI OCR to output the ABCDEFGHIJ from the TIF picture.

    Anyone please help me here...

    Code:
    Sub TestWords()
      
      Dim miDoc As MODI.Document
      Dim miWord As MODI.Word
      Dim strWordInfo As String
      
      ' Load an existing TIFF file.
      Set miDoc = New MODI.Document
      miDoc.Create "C:\document1.tif"
      
      ' Perform OCR.
      miDoc.Images(0).OCR
      
      ' Retrieve and display word information.
      Set miWord = miDoc.Images(0).Layout.Words(2)
      strWordInfo = _
        "Id: " & miWord.Id & vbCrLf & _
        "Line Id: " & miWord.LineId & vbCrLf & _
        "Region Id: " & miWord.RegionId & vbCrLf & _
        "Font Id: " & miWord.FontId & vbCrLf & _
        "Recognition confidence: " & _
        miWord.RecognitionConfidence & vbCrLf & _
        "Text: " & miWord.Text
      MsgBox strWordInfo, vbInformation + vbOKOnly, _
        "Word Information"
      
      Set miWord = Nothing
      Set miDoc = Nothing
    
    End Sub

  2. #2
    New Member
    Join Date
    Sep 2006
    Posts
    8

    Re: How to use MODI(MS Office Document Interface) in VB6?

    I pasted your code into a one-button form and it worked fine. I would try another TIF file - maybe the one you're using isn't formatted correctly.

    Mark

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: How to use MODI(MS Office Document Interface) in VB6?

    oic. The TIF is converted from BMP using Photoshop CS2. Is it the problem?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to use MODI(MS Office Document Interface) in VB6?

    Try this tif file, its zipped.
    Attached Files Attached Files
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: How to use MODI(MS Office Document Interface) in VB6?

    Quote Originally Posted by RobDog888
    Try this tif file, its zipped.
    Thanks. I think the problem is TIF file. I used your TIF is no problem at all.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to use MODI(MS Office Document Interface) in VB6?

    Quote Originally Posted by tanjiunnyann
    Thanks. I think the problem is TIF file. I used your TIF is no problem at all.
    No prob

    Probably just a google search is what I would try
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: How to use MODI(MS Office Document Interface) in VB6?

    Anyone knows another OCR dll can be used for recoginised BMP / JPG file? Or any recommends for me about the OCR solution in VB?

  8. #8
    Lively Member zexor's Avatar
    Join Date
    Mar 2010
    Posts
    68

    Re: How to use MODI(MS Office Document Interface) in VB6?

    how do you make a tif file that is readable by modi? every tif file i saved give me error at ocr.

  9. #9
    New Member
    Join Date
    Sep 2006
    Posts
    8

    Re: How to use MODI(MS Office Document Interface) in VB6?

    The files that I use are simply scanned on a flatbed scanner straight to a TIF file. MODI has had no problems with those.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width