macro for serial no. multi copy print
im new to macros so i dont know where ive gone wrong im trying to create a document that will add a new serial no. in incriements to each copy printed
Sub MySerial() Dim rngSerialLocation As Range Dim intSerialNum As Integer Dim strSerialNum As String Dim docCurrent As Document Dim intNumCopies As Integer Dim intCount As Integer ' set ref to current active doc Set docCurrent = Application.ActiveDocument ' set ref to the bookmarked serial number Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range ' get the starting number intSerialNum = Val(rngSerialLocation.Text) ' get the number of copies required intNumCopies = Val(InputBox$("How many Copies?", _ "Print Serialized", "1")) For intCount = 1 To intNumCopies ' print the document docCurrent.PrintOut Range:=wdPrintAllDocument ' increment the serial number intSerialNum = intSerialNum + 1 ' put into formatted version strSerialNum = Format(intSerialNum, "00000") ' stuff into proper place rngSerialLocation.Text = strSerialNum Next intCount ' reset the bookmark, since the updating procedure ' wipes out the old one docCurrent.Bookmarks.Add Name:="Serial", _ Range:=rngSerialLocation End Sub |
There's no way we can tell you what you might have done wrong, since you don't say what you have done... See also: https://www.msofficeforums.com/word-...numbering.html
|
All times are GMT -7. The time now is 08:47 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by
DragonByte SEO (Lite) -
vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft