Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-21-2018, 04:10 PM
gostgost gostgost is offline Continuous Numbering Windows 7 32bit Continuous Numbering Office 2016
Novice
Continuous Numbering
 
Join Date: Jan 2018
Posts: 3
gostgost is on a distinguished road
Default Continuous Numbering

Hello,

I am using the below macro (borrowed) on a document that I have, when I try and run the macro on my document (word 2016) it does nothing. Please help.


Thanks, Dave

Code:
Sub FilePrint()
Dim lStart As Long, lEnd As Long, i As Long
On Error GoTo ErrHandler
With ActiveDocument
  lStart = CInt(InputBox("What is the first Report to print?", _
    "Print Report From", .CustomDocumentProperties("Counter").Value + 1))
  lEnd = CInt(InputBox("What is the last Report to print?", _
    "Print Report To", lStart))
  If lStart = 0 Or lStart > lEnd Then GoTo ErrHandler
  For i = lStart To lEnd
    .CustomDocumentProperties("Counter").Value = i
    .Fields.Update
    If i = lStart Then
      With Application.Dialogs(wdDialogFilePrint)
        If .Show = 0 Then GoTo ErrHandler
      End With
    End If
    If i > lStart Then ActiveDocument.PrintOut
  Next
End With
ErrHandler:
End Sub

Last edited by macropod; 01-23-2018 at 11:01 AM. Reason: Added code tags
Reply With Quote
  #2  
Old 01-22-2018, 07:53 AM
Charles Kenyon Charles Kenyon is offline Continuous Numbering Windows 10 Continuous Numbering 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

I have not time to debug your code right now.
Does your document have a custom document property "Counter?"
What is it you are trying to do with this code?
You may want to look at Automatic numbering of Word documents by Graham Mayor.
Reply With Quote
  #3  
Old 01-23-2018, 07:18 AM
gostgost gostgost is offline Continuous Numbering Windows 7 32bit Continuous Numbering Office 2016
Novice
Continuous Numbering
 
Join Date: Jan 2018
Posts: 3
gostgost is on a distinguished road
Default Continuous Numbering

Charles,

I work for a volunteer fire department and I've created a blank report via Word that needs to be filled out after each run. I printed out say 100 blank reports forms, what I would like is for every time I print out the blank reports it is numbered already in a pre-defined position on the form. I would also like for before printing that it ask where to I want to start from and end.

I've copied the "certificate macro" which works on it own but when I apply it to my document if fails to work.

Thank you,

Dave.
Reply With Quote
  #4  
Old 01-23-2018, 11:19 AM
macropod's Avatar
macropod macropod is offline Continuous Numbering Windows 7 64bit Continuous Numbering Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The code you posted requires the document to have a Custom Document Property named "Counter" and a DOCPROPERTY field referencing that Custom Document Property. Does your document have both?

For some alternative approaches, see:
https://www.msofficeforums.com/word-...html#post13162
https://www.msofficeforums.com/word-...html#post34477
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-23-2018, 02:37 PM
gostgost gostgost is offline Continuous Numbering Windows 7 32bit Continuous Numbering Office 2016
Novice
Continuous Numbering
 
Join Date: Jan 2018
Posts: 3
gostgost is on a distinguished road
Default Continuous Numbering

Gents,

Thank you, I didn't know I had to go to file and add the counter there. Thank you so much you've save me a ton of work.

Dave.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does Word indexing change section page numbering to "continuous"? kaspencer Word 6 07-02-2015 02:24 PM
Continuous Numbering begin each section with page 1 in header PLUS continuous page numbering in footer onemorecupofcoffee Word 18 09-04-2013 04:31 PM
Continuous Numbering Section Break Continuous: doesn't affect the format of the page numbering Jamal NUMAN Word 2 06-22-2011 04:46 PM
Continuous page numbering in a merged document dkeinath Mail Merge 0 07-30-2010 09:30 AM

Other Forums: Access Forums

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