
1、首先需要下载并安装免费(开源)的图片虚拟打印机驱动ImagePrinter:http://sourceforge.net/projects/imageprinter/2、点击“开始 - 所有程序 - Image Printer - Options ImagePrinter”,做如下设置:(1)在System选项页,勾上 Save original name 这个选项;然后设置Output folder 为你希望输出图片文件存放的根目录;(2)在File Format选项页,选择文件格式为JPG;(3)单击 Ok 确定。2、打开Word,随便新建一个文档;3、键入Alt+F11打开VBA编辑环境,选择菜单项“插入 - 模块”;4、在代码编辑区粘贴如下代码:Option ExplicitConst g_strRootPath = "C:\Temp\Docs\Word\ToPrint" ' 存放所有文件的目录,可以有子目录Sub BatchPrintToImagePrinter() On Error Resume Next Dim fso, oFolder Dim strPreviousPrinter As String strPreviousPrinter = Application.ActivePrinter Application.ActivePrinter = "ImagePrinter" Set fso = CreateObject("Scripting.FileSystemObject") Set oFolder = fso.GetFolder(g_strRootPath) BatchPrintToImagePrinterUnderFolder fso, oFolder Application.ActivePrinter = strPreviousPrinter MsgBox "完成!"End SubSub BatchPrintToImagePrinterUnderFolder(fso, oFolder) Dim oSubFolder, oFile For Each oSubFolder In oFolder.SubFolders BatchPrintToImagePrinterUnderFolder fso, oSubFolder Next For Each oFile In oFolder.Files Documents.Open FileName:=oFile.Path ActiveDocument.PrintOut ActiveDocument.Close True NextEnd Sub5、修改代码中的参数g_strRootPath,指定所有需要转换的Word文件存放的根目录(下面可以有子目录);6、键入F5运行,直到看到提示“完成”,而且双击屏幕右下角那个打印机图标,看到弹出的打印窗口里面打印队列已全部完成(可能会比较慢),然后到步骤 1(1) 中指定的图片输出目录下检查图片是否转换成功(图片命名规则基本上是在源文档的名字后面加入一些顺序增加的数字后缀)。
