Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2018, 11:42 AM
robertcraft robertcraft is offline Cross Reference or VBA Editor to update while printing Windows 10 Cross Reference or VBA Editor to update while printing Office 2016
Novice
Cross Reference or VBA Editor to update while printing
 
Join Date: Mar 2018
Posts: 1
robertcraft is on a distinguished road
Default Cross Reference or VBA Editor to update while printing

So I am able to use this formula

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

to auto number a document that I am doing.

I am making raffle tickets that will be torn apart into two pieces. Top copy as the receipt, bottom portion will be the actual ticket. I have my document set to update on the top and I want it to update on the bottom as well when I print. I have tried to redo the code for the bottom portion or use cross reference and neither option seems to work.

Any idea?
Attached Files
File Type: docx Raffle Ticket.docx (397.4 KB, 7 views)
Reply With Quote
  #2  
Old 03-19-2018, 01:13 PM
Charles Kenyon Charles Kenyon is offline Cross Reference or VBA Editor to update while printing Windows 10 Cross Reference or VBA Editor to update while printing Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Uhm, when I do raffle tickets or other numbering of that sort, I use a SEQ field rather than a macro. For me, it is much easier.

https://support.office.com/en-us/art...rs=en-US&ad=US

SEQuence Field

Here's are videos on doing it using Mail Merge .
https://www.youtube.com/watch?v=EmQTCKmqtmI
https://www.youtube.com/watch?v=EmQTCKmqtmI

This one works with the Raffle Ticket template available online.
https://www.youtube.com/watch?v=pU2imaXpWPE

(The mail merge methods look easier than the way I've been doing it.)
Reply With Quote
Reply

Tags
cross reference, raffle, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross reference at different levels jineu21 Word 6 03-20-2017 05:34 AM
Cross reference is bad. Leffken Word 1 06-09-2016 03:12 PM
Cross Reference or VBA Editor to update while printing Cross-reference function to update bullet header and number simultaneously dljenks Word 1 01-03-2014 01:38 PM
Cross Reference or VBA Editor to update while printing Reference number and cross reference for equation numbers to match the thesis format wmac Word 1 05-14-2013 08:54 PM
Cross Reference or VBA Editor to update while printing Cross-reference in two lines!!!!! Jamal NUMAN Word 3 04-12-2011 06:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:35 PM.


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