admin 管理员组文章数量: 1184232
2024年3月28日发(作者:block可数吗)
如何让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
xt Text:="000" & i&
ut 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
xt Text:="00" & i&
ut 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 >= 100) And (i < 1000) Then
xt Text:="0" & i&
ut 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 >= 1000) And (i < 10000) Then
xt Text:=i
版权声明:本文标题:如何让WORD在打印时自动加上打印份数编号 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1711572210a600418.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论