如何让WORD 在打印时自动加上打印份数编号 by nosper on 一月 5th, 2011 问题的提出: 老婆所在的公司需要做2011 年整年的文档和表格,里面的编号随着打印份数自动更新:比如需要打印100 份,每份编号则按顺序从 0001 排到 0100。 在网上google 了一下,也有不少网友提出了类似的问题: “公司有一份调查表,需要打印100 份,每份都要有一个编号,从000001 到000100。如何让WORD 在打印时自动加上打印份数编号?” 这个需要用到word 的宏操作,感觉它和ps 里面的action 一样,就是可以让用户自定义一些操作,让宏来重复执行。word2007 有宏录制功能(在view 视窗栏里面)。 方法一:宏循环嵌套 先手动几次:改编号——打印——改下一个编号——再打印, 让宏来记录这些动作。然后查看这些基本动作的宏代码,在里面加入循环和嵌套。 经过自己几次尝试和修改,得到如下宏代码: Sub PrintCopies() ' ' Macro1 Macro ' ' Dim i As Long Dim lngStart Dim lngCount lngCount = InputBox("Please enter the number of copies you want to print", "Please enter the number of copies you want to print", 1) If lngCount = "" Then Exit Sub End If lngStart = InputBox("Enter the starting number you want to print", "Enter the starting number you want to print", 1) If lngStart = "" Then Exit Sub End If For i = lngStart To lngCount If i < 10 Then Selection.TypeText Text:="000" & i& Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _ ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _ False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 End If If (i >= 10) And (i < 100) Then Selection.TypeText Text:="00" & i& Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _ ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _ False, ...