Home > Software engineering >  Have a great god help to look at, want to use this, word printing automatic numbering contract, how
Have a great god help to look at, want to use this, word printing automatic numbering contract, how

Time:01-05

Sub PrintCopies ()

'

'Macro1 Macro

'

'

Dim As Long I

Dim lngStart

Dim lngCount

LngCount=InputBox (" both Please enter the number of copies you want to print ", "both Please enter the number of copies you want to print", 1)

If lngCount="" Then

The Exit Sub

End the If

LngStart=InputBox (" Enter the starting number you want to print ", "Enter the starting number you want to print", 1)

If lngStart="" Then

The Exit Sub

End the If

For I=lngStart To lngCount

If I & lt; 10 Then

Selection. TypeText Text:="000" & amp; I&"

Application. The 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 the If


If (I & gt;=10) And (I & lt; 100) Then

Selection. TypeText Text:="00" & amp; I&"

Application. The 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 the If



If (I & gt;=100) And (I & lt; 1000) Then

Selection. TypeText Text:="0" & amp; I&"

Application. The 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 the If

If (I & gt;=1000) And (I & lt; 10000) Then

Selection. TypeText Text:=I

Application. The 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 the If

Selection. TypeBackspace

Selection. TypeBackspace

Selection. TypeBackspace

Selection. TypeBackspace

Next

End Sub

  • Related