多语言展示
当前在线:522今日阅读:103今日分享:49

让WORD在打印时自动加上打印份数编号

要做一个食堂的调查问卷,为了记录分发的份数,要求在调查问卷上加上编号,以前只知道页脚添加页码,但是只能标注一份有几张,这里显然用不了,所以只好百度之,终于找到了方法,通过录制运行宏的方法就可以实现了
步骤:
2

第二步在弹出的宏录制窗口内输入宏代码,然后保存,如图宏代码如下:Sub PrintCopies()‘‘ Macro1 Macro‘‘Dim i As LongDim lngStartDim lngCountlngCount = InputBox(“Please enter the number of copies you want to print”, “Please enter the number of copies you want to print”, 1)If lngCount = “” ThenExit SubEnd IflngStart = InputBox(“Enter the starting number you want to print”, “Enter the starting number you want to print”, 1)If lngStart = “” ThenExit SubEnd IfFor i = lngStart To lngCountIf i < 10 ThenSelection.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:=0End IfIf (i >= 10) And (i < 100) ThenSelection.TypeText Text:=”00″ & 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:=0End If If (i >= 100) And (i < 1000) ThenSelection.TypeText Text:=”0″ & 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:=0End IfIf (i >= 1000) And (i < 10000) ThenSelection.TypeText Text:=iApplication.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:=0End IfSelection.TypeBackspaceSelection.TypeBackspaceSelection.TypeBackspaceSelection.TypeBackspaceNextEnd Sub

3

第三步把输入光标放在你想要添加打印份数编号的地方,然后运行宏,会弹出如下窗口,第一个窗口是输入打印份数,第二个窗口是输入起始数字,如图

推荐信息