Table of Contents
Is Microsoft Word Missing a Scanner? Here’s the Brilliant Trick to Restore Multi-Page Scanning.
Microsoft Word used to have a built-in tool to scan documents. That feature is no longer available in recent versions of the software. However, you can add this function back yourself. This guide explains how to use a special script, called a macro, to make Word work with a free scanning program called NAPS2. This method allows you to scan multiple pages directly into your document.
How It Works
The solution involves placing a set of instructions, written in a code called Visual Basic for Applications (VBA), into Word. This code acts as a bridge. It tells a separate, free program named NAPS2 to start scanning. Once NAPS2 finishes scanning your pages, the macro automatically inserts the scanned images into your active Word document.
This method uses a VBA component known as WScript.Shell to run the NAPS2 program. This is a powerful tool that can execute commands on your computer, so it is important to be aware of the security implications. Malicious documents sometimes use similar scripts to cause harm.
Step-by-Step Guide to Add Multi-Page Scanning
Follow these steps to set up the multi-page scanning feature.
- Download and Install NAPS2: NAPS2 is free software that controls your scanner. You must install it on your computer before proceeding.
- Enable Macros in Word: For this to work, you must change Word’s security settings. Macros from the internet are often blocked by default to protect your computer from viruses. To change this, go to File > Options > Trust Center > Trust Center Settings > Macro Settings. To be safe, choose “Disable all macros except digitally signed macros” or “Disable all macros with notification.” You will then need to approve the document as trusted when you open it. Be very careful when enabling macros, as they can be a security risk.
- Insert the VBA Code: Open Word, press Alt + F11 to open the VBA editor, then paste the provided code into a new module.
Sub NAPS2_Feeder() ' 'NAPS2_Feeder ScanMacro ' Made from AI template in November 2025 by Ingbert ' ' DEFINITION OF VARIABLES Dim WshShell As Object Dim NAPS2Path As String Dim Device As String Dim Driver As String Dim TempFilePath As String Dim TempFile As String Dim strFile As String Dim objDoc As Document Dim Command As String Dim ExitCode As Long ' --- CONFIGURATION START (NEEDS TO BE ADAPTED TO LOCAL REQUIREMENTS! ) --- NAPS2Path = "C:\Program Files\NAPS2\NAPS2.Console.exe" ' 1. Path to NAPS2.Console.exe Device = "brother" ' 2. Name of device - caseinsensitive partial match is OK Driver = "wia" ' 3. Device driver (wia or twain) TempFilePath = ("C:\TempScans") ' 4. Path to folder for temporary image file TempFile = "\NAPS2_Scan.jpg" ' 5. Name of temporary image file (.jpg or .png) ' --- CONFIGURATION END --- On Error GoTo Error Management ' 1. CHECK IF NAPS2 CONSOLE IS PRESENT If Dir(NAPS2Path) = "" Then MsgBox "ERROR: NAPS2 Console not found at " & NAPS2Path, vbCritical ' "ERROR: NAPS2 console version not found at: " Exit Sub End If ' 2. CLEAN FOLDER FOR TEMPORARY IMAGE FILES On Error Resume Next Kill (TempFilePath & "\" & "*.jpg") ' Change "jpg" if a different image format has been selected at 5. above On Error GoTo 0 ' 3. COMPILE COMMAND FOR SCANNING BY NAPS.console.exe ' Arguments as listed on https://www.naps2.com/doc/command-line Command = """" & NAPS2Path & """ --noprofile --driver """ & Driver & """ --device """ & Device & """ --source feeder -o """ & TempFilePath & TempFile & """ --deskew --dpi 300 --pagesize a4" ' 4. COMPILE WScript.Shell OBJECT Set WshShell = CreateObject("WScript.Shell") Application.StatusBar = "Starting NAPS2 scan, waiting..." ' "Starting NAPS2 scan and waiting for completion..." '5. RUN COMMAND ExitCode = WshShell.Run(Command, 0, True) ' 0 = vbHide (hiding window), True = Wait until process is complete (IMPORTANT!) Set WshShell = Nothing Application.StatusBar = "Scan completed. Pasting file..." ' "Scan completed. Pasting file into Word..." Set objDoc = ActiveDocument ' 6. SEARCH FOR FIRST IMAGE FILE (*.jpg) strFile = Dir(TempFilePath & "\" & "*.jpg", vbNormal) ' 7. PASTE ALL FOUND FILES ONE AFTER THE OTHER Do While strFile <> "" With objDoc.Content 'Paste image at current cursor position (InlineShape = in text line) Selection.InlineShapes.AddPicture FileName:=TempFilePath & "\" & strFile, LinkToFile:=False, SaveWithDocument:=True End With strFile = Dir() ' Search for next file Loop Set objDoc = Nothing 8. DELETE TEMPORARY FILE(S) On Error Resume Next Kill (TempFilePath & "\" & "*.jpg") ' Change "jpg" if a different image format has been selected On Error GoTo 0 Application.StatusBar = "Done: Scan successfully pasted." ' "Done: Scan successfully pasted." '9. EXIT WITHOUT ERROR Exit Sub '10. ERROR MANAGEMENT Error management: Set WshShell = Nothing Application.StatusBar = False MsgBox "Unexpected VBA error: " & Err.Description, vbCritical ' "An unexpected VBA error has occurred: " End Sub - Configure the Code: You must edit the “CONFIGURATION” section of the code to match your setup.
- NAPS2Path: Change this to the location of the NAPS2.Console.exe file on your computer.
- Device: Enter the name of your scanner. A partial name usually works.
- Driver: Choose between “wia” or “twain” drivers, depending on your scanner.
- TempFilePath: Create a folder on your computer for temporary scan files (e.g., C:\TempScans) and put the path here.
Understanding the Code’s Actions
The VBA code performs a series of tasks to automate the scanning process.
- Checks for NAPS2: It first verifies that the NAPS2 program exists at the path you provided.
- Clears Old Files: The macro deletes any leftover image files from the temporary folder.
- Builds the Command: It creates a command-line instruction to send to NAPS2. This command includes details like the scanner driver, device name, and output file path (-o). It also uses other options like –deskew to straighten pages and –dpi 300 for resolution.
- Runs the Scan: It uses the WshShell.Run command to execute the scan order, hiding the command window and waiting for the process to finish.
- Inserts the Images: After the scan is complete, the code finds each scanned image file in the temporary folder and inserts them one by one into your Word document.
- Cleans Up: Finally, it deletes the temporary image files it created.
Disclaimer: This VBA code is provided for informational purposes. Using macros, especially those that execute external programs, involves security risks. No liability is assumed for any issues that may arise from its use.