Free OCR in Microsoft Excel 2007 for VBA users

Add Tools-->Reference-->Microsoft Office Document Imaging Viewer Control 12

MODI 

Create an image as a test and store in c drive  "C:\canvas.png"

Then run this code in a new button  

Sub Button1_Click()
   

    Dim modiDoc As MODI.Document
    Dim modiLayout As MODI.Layout
    Dim strLayoutInfo As String
    Set modiDoc = New MODI.Document
    modiDoc.Create "C:\canvas.png"
    modiDoc.Images(0).OCR
    Set modiLayout = modiDoc.Images(0).Layout
    strLayoutInfo = _
        "Language: " & modiLayout.Language & vbCrLf & _
        "Number of characters: " & modiLayout.NumChars & vbCrLf & _
        "Number of fonts: " & modiLayout.NumFonts & vbCrLf & _
        "Number of words: " & modiLayout.NumWords & vbCrLf & _
        "Beginning of text: " & Left(modiLayout.Text, 50) & vbCrLf & _
        "First word of text: " & modiLayout.Words(0).Text
    MsgBox strLayoutInfo, vbInformation + vbOKOnly, _
        "Layout Information"
    Set modiLayout = Nothing
    Set modiDoc = Nothing

End Sub
SHARE

Oscar perez

Arquitecto especialista en gestion de proyectos si necesitas desarrollar algun proyecto en Bogota contactame en el 3006825874 o visita mi pagina en www.arquitectobogota.tk

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comentarios:

Publicar un comentario