Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-22-2012, 03:05 AM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

How can I use a macro to generate printouts of a let's say a certificate with serial numbers starting from 000001 through 000050 for exactly in the right upper corner of a document printing all files (pdf files printed with a pdf printer)? How do you tell this macro where to place the number? In my case I'd prefer to put in the right upper corner of a 2 cell table, where the lefty cell contains the name of a club the right cell contains the serial number only, right justified.

Is there a way to have all pages printed automatically without wasting time by giving different names to the pdf files? As a matter of fact, I don't even need them in pdf format, Word doc files would be great too.



But in any event, even if you don't have a feasible solution for automatic word file generation, it would be great if you could help me with the 6 digit serial number in the right side of a 2 cell table or if you could tell me how to tell the macro where to place the serial number with a bookmark or something. So far I tried several serial number macros all of them using a bookmark for positioning the number, none of them worked, I have no clue why.
Reply With Quote
  #2  
Old 05-22-2012, 04:05 AM
macropod's Avatar
macropod macropod is offline Sequential Document Numbering Windows 10 Sequential Document Numbering Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Geza,

It's not clear whether/why you want to create a document with multiple pages, or simply generate a sequentially-numbered printout.

If you want to generate a document with multiple identical pages, simply put all the content into the page header, then use manual page breaks to create new pages. The only thing you'll need to do with your sample is to use a page numbering field to provide the sequential numbers. A macro could then be used to tell Word what number to start from and how many page breaks to add.
Reply With Quote
  #3  
Old 05-22-2012, 04:28 AM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

Hi Paul,

"or simply generate a sequentially-numbered printout." is the one that I am trying to accomplish. I already tried the method that you suggested but the page numbering will not generate zeros in front of the page number.

If this was the only instance when I need this, I could have used the page numbering and would have created pages like this from 1 to 9, 11 to 99, etc., adding 00000, 0000 in front of them, but I need to create other forms also.

The form that I need to multiply takes up the full page, I just didn't bother to put it here because it is in Hungarian. It is a form to be filled out with hand writing, therefore placing the whole page into the heather wouldn't work I think.
Reply With Quote
  #4  
Old 05-22-2012, 04:59 AM
macropod's Avatar
macropod macropod is offline Sequential Document Numbering Windows 10 Sequential Document Numbering Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Geza,

You can indeed use have page numbers with leading 0s, and a template to produce them. And you can have the whole page in the header. See attached demo. All you need to do is unzip it, then double-click on the dot file. A new document will be produced, with a couple of numbering prompts.

In your first post, you said you wanted:
Quote:
to generate a given number of pages in a word document by copying the content of the 1st page to the rest and adding an incremental serial number to the right upper corner of the page (form).
That is what the attachment demonstrates without having to produce multiple separate documents. IIRC, your posts in the other thread mentioned problems with producing PDF output because it produced separate files that each had to be saved separately. The process in the attached document should resolve that.
Attached Files
File Type: zip Multi-Page Demo.zip (16.6 KB, 435 views)
Reply With Quote
  #5  
Old 05-22-2012, 05:23 AM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

Hi Paul,

Wow, this is working! I know, this must be a simple thing for those, who are expert in these things but it is definitely not simple even for computer professionals who are experts of IT stuff other than programming or macro writing.

May I ask, how can I control the number of zeros in front of the numbers, or better said, how can I control the total number of digits? In my present case, I need six digits, but I know that I will need 5 and 3 digit options in the near future.

I went into the VBA code of the word doc to see if I can find a code or some kind of declaration (wow, I still have some vocabulary left from my ALGOL and GW BASIC classes that would resemble me for these zeros but couldn't found anything.

Also, I noticed that the "body" of the text is grayed out, so it is indeed part of the header/footer, but when I go in, that text is BETWEEN the frame boxes of the header and the footer.

When I open a blank document and view footer and header, I am not getting the option to write between the boxes. So, how can I place a whole page of text into footer or header bypassing the footer/header view/editor page?
Reply With Quote
  #6  
Old 05-22-2012, 05:58 AM
macropod's Avatar
macropod macropod is offline Sequential Document Numbering Windows 10 Sequential Document Numbering Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Geza,

To control the number of leading 0s, open the template for editing, select page number field in the header and press Shiftt-F9. Then you'll see a field coded as {PAGE \# 0000}. Simply add/delete 0s as required. This is field coding, not vba code. When you're done, press F9 to update the field.

As for the other content, it's all in a textbox that I've placed 'behind text' in the header. That just makes it easier to see the top of the page when the document opens. You could delete the textbox, put it in front of the text, or leave it where it is and replace what's there with your own content. You could also reposition/resize it - provided it stays in the header.
Reply With Quote
  #7  
Old 05-22-2012, 07:10 AM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

Hi Paul,

I got it! Thanks to you I also just finished a "crash course" on the usage of the text box that I didn't even know that it existed in Word, that can also greatly enhance page design.
(just by reading the help info on difference between the text box and the frame).

Great! My problem is resolved.

Thank You!
Geza
Reply With Quote
  #8  
Old 05-22-2012, 07:20 AM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

Hi Paul,
Do you know why the serial number cannot be higher than 32766?

First I tried to create serial numbers above 40000, the result was, that it numbered the pages from 000001 to 000050

Then on trial and error I figured out that 32766 is the magic number that it cannot go above. Is there a way to increase this number or it is due to internal limitations of Word 2003?

Geza
Reply With Quote
  #9  
Old 05-22-2012, 08:25 AM
macropod's Avatar
macropod macropod is offline Sequential Document Numbering Windows 10 Sequential Document Numbering Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Geza,

AFAIK that's a page count limit for the doc format native to Word 2003 & earlier. The docx format in Word 2007 & later supports page #s up to 2,147,483,647.

In Word 2003 & earlier, one can combine the page# field with a formula field to get to a higher #. See attached. The key change is the addition of a custom document property named 'StartNum'. With this, your doc format document can have starting numbers up to 2,147,483,647 too.
Attached Files
File Type: zip Multi-Page Demo.zip (10.7 KB, 166 views)
Reply With Quote
  #10  
Old 05-22-2012, 08:35 AM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

Hi Paul,

Thank you for the solution, I thought, that I will have to live with the 32766 limit "for the rest of my life".

How can I add this custom doc. prop to a template that I already created with the previous version? I tried to add a custom prop "StartNum Number 0" to it, ran it, but it didn't work.

Geza
Reply With Quote
  #11  
Old 05-22-2012, 08:55 AM
macropod's Avatar
macropod macropod is offline Sequential Document Numbering Windows 10 Sequential Document Numbering Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Geza,

Did you add the new macro code and the corresponding formula field in the header as well?

Although the addition of the custom document property is the key to getting higher numbers, it wasn't the only change.
Reply With Quote
  #12  
Old 05-22-2012, 10:35 AM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

Hi Paul,

I didn't but now when I tried to add the line

{={DOCPROPERTY StartNum}+{PAGE}-1 \# 000000}

I got this syntax error:

!Syntax Error, {

But I think it is time for me to stop here, since I am not a Word guru and not dealing with problems like this every day, in a few weeks or a month I won't remember enough to use this new info anyway.

I will fix this problem right now by copying/pasting the content of the old template into the new one and reposition the serial number.

Thank you for giving me the solution, it works great!

Cheers,
Geza
Reply With Quote
  #13  
Old 05-22-2012, 12:30 PM
macropod's Avatar
macropod macropod is offline Sequential Document Numbering Windows 10 Sequential Document Numbering Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Geza,

The syntax error will be because you typed the '{'. You can't do that with field braces - they're created in pairs via Ctrl-F9. You could, of course, simply copy & paste the field from the template I posted.
Reply With Quote
  #14  
Old 05-23-2012, 12:17 PM
Geza59 Geza59 is offline Sequential Document Numbering Windows XP Sequential Document Numbering Office 2003
Novice
Sequential Document Numbering
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Default

Hi Paul,

I copy/pasted the field code, the error went away but it still doesn't work.

I meant to ask you, how can I start the macro again in this case since it is not really a macro? (I cannot see any macro listed under Macros.) What I mean, is how can I start it without closing the document or in this case the template file and reopening it again?

You also asked if I copied the Macro code, I didn't know there is a Macro involved here since I don't see any listed under macros.

Geza
Reply With Quote
  #15  
Old 05-24-2012, 11:41 PM
macropod's Avatar
macropod macropod is offline Sequential Document Numbering Windows 7 64bit Sequential Document Numbering Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Geza,

If you open the template and press Alt-F11, the vb editor will open. If you don't see the Document_New and Document_Open macros, click on the template's 'ThisDocument' module and you should see them. The reason you don't ordinarily see these macro is that they're prefixed with 'Private', which is normal for this kind of macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Other Forums: Access Forums

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