关于office自带的OCR
Dim strLayoutInfo As String, strLPN As String '初始化并加载文档 Set miDoc = CreateObject("MODI.Document") '创建对象 miDoc.Create "D:\未命名.jpg" '加载图片文件 Screen.MousePointer = vbHourglass '设置光标忙 '识别 miDoc.Images(0).OCR miLANG_CHINESE_SIMPLIFIED, True, True '有用的就此一句,识别为中文简体 ============报错行 Set modiLayout = miDoc.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 miDoc = Nothing Screen.MousePointer = vbDefault