Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-25-2019, 02:13 PM
limdul9992 limdul9992 is offline Having a field update sequentially from Excel when printing. Windows 10 Having a field update sequentially from Excel when printing. Office 2010
Novice
Having a field update sequentially from Excel when printing.
 
Join Date: Jul 2019
Posts: 5
limdul9992 is on a distinguished road
Default Having a field update sequentially from Excel when printing.

Hi Everyone,



So my question is can I have a word document that has a work order number in the header look for that work order number in Excel and then grab the serial number in Excel and import it to the serial number field in word? Then I would also like it to print x amount of copies and have the serial number go up by one for each paper that is printed? So for example I would print 25 sheets with work order WO-0500 in the upper right. I would like it to pull the first serial number from Excel that has the WO-0500 and print 25 copies with each copy changing the serial number up by one.
Reply With Quote
  #2  
Old 07-25-2019, 02:41 PM
gmaxey gmaxey is offline Having a field update sequentially from Excel when printing. Windows 10 Having a field update sequentially from Excel when printing. Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

There are lots of examples for pulling data from Excel available from a Google search. As for printing sequentially numbered copies, you could adapt the following to use your Excel value as the starting number:

Code:
  Sub PrintNumberedCopies()
  Dim NumCopies As String
  Dim StartNum As String
  Dim Counter As Long
  Dim oRng As Range
    If MsgBox("The copy number will appear at the insertion point." _
            & " Is the cursor at the correct position?", _
             vbYesNo, "Placement") = vbNo Then End
    If ActiveDocument.Saved = False Then
      If MsgBox("Do you want to save any changes before" & _
                " printing?", vbYesNoCancel, "Save document?") = vbYes Then
        ActiveDocument.Save
      End If
    End If
    StartNum = Val(InputBox("Enter the starting number.", "Starting Number", 1))
    NumCopies = Val(InputBox("Enter the number of copies that" & _
                             " you want to print", "Copies", 1))
    ActiveDocument.Bookmarks.Add Name:="CopyNum", Range:=Selection.Range
    Set oRng = ActiveDocument.Bookmarks("CopyNum").Range
    Counter = 0
    If MsgBox("Are you sure that you want to print " _
              & NumCopies & " numbered " & " copies of this document", _
              vbYesNoCancel, "On your mark, get set ...?") = vbYes Then
      While Counter < NumCopies
        oRng.Delete
        oRng.Text = StartNum
        ActiveDocument.PrintOut
        StartNum = StartNum + 1
        Counter = Counter + 1
      Wend
    End If
  lbl_Exit:
    Exit Sub
  End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Field Update MANOHAR Word VBA 6 06-17-2018 07:18 PM
Update & Unlink Specific Merge Field in Word Doc from Mail Merge - Excel VBA RMerckling Mail Merge 16 05-17-2018 05:19 PM
sequentially numbering one worksheet kromertma Excel Programming 1 08-02-2016 12:01 AM
Having a field update sequentially from Excel when printing. Can field dynamically update? namedujour Word 2 03-04-2016 10:21 PM
Having a field update sequentially from Excel when printing. Sequentially numbering a document UniAdmin Word VBA 1 02-21-2013 07:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:13 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