Graham Mayor

... helping to ease the lives of Microsoft Word users.


Many people access the material from this web site daily. Most just take what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved would help to ensure the continued availability of this resource. Click the appropriate button above to access PayPal.

Scanning into Microsoft Word from Version 2007 onwards

Word 2007/2010

There have been numerous complaints from Word 2003 users who have upgraded to Word 2007/2010 that the tool that allows documents to be scanned as images, directly into Word, appears to be missing in the newer versions. In fact it is not missing, but very well hidden, however, fellow MVP Herb Tyson spotted that the ancient WordBasic command to call the old dialog has been retained in the application, and so with a little juggling and the aid of a macro, it is possible to add the command to the QAT (Quick Access Toolbar) thus restoring the ability to scan into these versions.

The macro code is simplicity itself

Sub InsertFromScanner()
On Error Resume Next
WordBasic.InsertImagerScan
End Sub

Clicking the button (or running the macro) produces the following familiar dialog:

Word 2013 and later (it also works for 2007 and 2010)

Simple though the above is for Word 2007 and 2010, it doesn't work with Word 2013 and later, as the all important WordBasic command has been removed from the VBA command set of those versions. Fortunately all is not lost. A more complex approach will do the job, and, as the heading suggests, this version also works for Word 2007 and 2010.

The following macros include alternative code samples for Excel and Outlook e-mail messages.

The method uses the WIA interface which requires a reference to the Microsoft Windows Image Acquisition object library to be set in vba - tools > references.

The macro displays the WIA dialog

Sub Scan()
'Requires a reference to Microsoft Windows Image Acquisition Object Library
Dim objCommonDialog As WIA.CommonDialog
Dim objImage As WIA.ImageFile
Dim strPath As String

On Error Resume Next
Set objCommonDialog = New WIA.CommonDialog
Set objImage = objCommonDialog.ShowAcquireImage
strPath = Environ("TEMP") & "\TempScan.jpg" ' set temporary file

If Not objImage Is Nothing Then
objImage.SaveFile strPath ' save into temporary file
' Insert in Word Document
Selection.InlineShapes.AddPicture strPath

'+++++++++++++++++++++++++++++++++++++
' Insertion alternatives


' Insert in Excel worksheet
'ActiveSheet.Pictures.Insert(strPath).Select

'Insert into Outlook message
'If TypeName(ActiveWindow) = "Inspector" Then
' If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
' ActiveInspector.WordEditor.Application.Selection.InlineShapes.AddPicture strPath
' End If
'End If
'+++++++++++++++++++++++++++++++++++++
Set objImage = Nothing
End If
If Not Dir(strPath) = vbNullString Then Kill strPath 'Remove the temporary file
Set objCommonDialog = Nothing
End Sub

 

If you don't know to employ the codes used on this page or add the command button to the QAT (Quick Access Toolbar), see - https://www.gmayor.com/installing_macro.htm

 

 

Scan into Word

When you scan into Word, the imported text is in the form of an uneditable graphic. If you want editable text, you must use OCR software.

Office 2010 for example includes a rudimentary OCR function as part of One Note that can be used, but for better results you will need a third party product. My personal favourite is ABBYY Finereader.