[German edition]Microsoft Office 2013 is shipped with new features, but some users are missing usability. For instance, a simple button to scan directly from Word 2013 is missing. Also old solutions won’t work anymore. Therefore I’ve developed a solution, to add a scan option to Word 2013.
How it it shall work …
I’m using a German Word 2013, so all screenshots are made by this version. My idea was to establish a button Scan within the Word 2013 ribbon bar (Tab Insert).
Using this button invokes the dialog box shown below. A user may select the WIA device to obtain a photo.
After clicking OK, the WIA dialog box shown below will be visible. Here we see the scanner dialog box.
Using the Scan button obtains the scan from the connected device and inserts it into the Word document. Therefore it’s required, that Windows supports WIA drivers and devices.
Implementing a macro for WIA control
How to implement this feature in Word 2013? The View tab contains the Macro button which may be used to invoke the Macros dialog box. The button create may be used to add a VBA macro.
After searching a while, I was not able to find a Word object to scan – and I wasn’t successful to invoke OneNote scan button from Word. Therefore I inspected the Type-Libraries (Menu Tools, command References).
I found the “Windwos Image Acquisition Library” type library, that may be used to access the WIA interface.
VBA code to access the WIA interface
After identifying the WIA type library I made a short research and found some VBA code fragments to access WIA [1,2], deleting a file  and to detect the Temp folder  (used to store the temporary image file). Here is the VBA source code.
‘ Scan for Word 2013
‘ Author: Günter Born www.borncity.de blog.borncity.com
‘ Implements a Scan function in Word 2013
Private Declare Function GetTempPath Lib „kernel32“ Alias „GetTempPathA“ (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Function TempPath() As String
Const MaxPathLen = 256 ‘ Max path length
Dim FolderName As String ‘ Folder name
Dim ReturnVar As Long ‘ Return Value
FolderName = String(MaxPathLen, 0)
ReturnVar = GetTempPath(MaxPathLen, FolderName)
If ReturnVar <> 0 Then
TempPath = Left(FolderName, InStr(FolderName, Chr(0)) – 1)
TempPath = vbNullString
‘ Scan Macro, to be invoked in Word
On Error Resume Next
Dim objCommonDialog As WIA.CommonDialog
Dim objImage As WIA.ImageFile
‘ instantiate Scan WIA objects
Set objCommonDialog = New WIA.CommonDialog
Set objImage = objCommonDialog.ShowAcquireImage
strDateiname = TempPath & „Scan.jpg“ ‘ set temporary file
If Not objImage Is Nothing Then
objImage.SaveFile strDateiname ‘ save into temp file
Selection.InlineShapes.AddPicture strDateiname ‘ insert in doc
Set objImage = Nothing
Set objCommonDialog = Nothing
‘ MsgBox strDateiname ‘ test output
The VBA code initiates a WIA.CommonDialog object and invokes the ShowAcquireImage method. The method returns the scan as an object. This will be stored temporarily and will be inserted into Word document file.
Add a scan button
At least we need to add a Scan button at Insert tab and associate it with the VBA macro.
1. Right click the ribbon bar und select the command to change ribbon settings.
2. Select the entry “macro” in the left list of dialog box Word options.
3. Add a new group entry “Scan” to Insert tab and associate the macro from left list to this new group. Name it “Scan” and assign an appropriate image to this button.
After closing the dialog box, the new Scan button shall be working. Here is a download file Scan1.zip, containing a Word *.docm file and a macro code file (.bas) with a a ready to use solution. You may use the sample and copy the macro code to your Normal.dot file.