Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
danieldc danieldc is offline
external usenet poster
 
Posts: 6
Default VBA code to get page numbers and print multi section documents!

I have a nice word 2000 VBA code to get a single simple document, in
one unique section, and print it as a book (double faced paper, 2
pages per paper face, page number scheme 4-1, 2-3, 8-5, 6-7).

But when the document has more than 1 section, there is a terrible
mistake at printing pages.

If the document:
- 1st section has 4 pages (numbered 1-4)
- 2nd section more 10 pages (numbered 1-10)

When printing something like "4,1", it result in some pages, equal to
section 1 pages 1 to 4, section 2 page 4 (sort of random like )


What a hell this kind of stupid feature called "section print" (have a
look at "help printing sections") !!!


What I asked is:

1) in a single section document, is it possible to make an Index at
document 5th page, but showing there "page number = 1" ???

2) what is the correct / better way to handle/print multi section
documents ?


Thanks, yours,
Daniel, from Brazil

  #2   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
Jean-Guy Marcil Jean-Guy Marcil is offline
external usenet poster
 
Posts: 67
Default VBA code to get page numbers and print multi section documents!

danieldc was telling us:
danieldc nous racontait que :

I have a nice word 2000 VBA code to get a single simple document, in
one unique section, and print it as a book (double faced paper, 2
pages per paper face, page number scheme 4-1, 2-3, 8-5, 6-7).

But when the document has more than 1 section, there is a terrible
mistake at printing pages.

If the document:
- 1st section has 4 pages (numbered 1-4)
- 2nd section more 10 pages (numbered 1-10)

When printing something like "4,1", it result in some pages, equal to
section 1 pages 1 to 4, section 2 page 4 (sort of random like )


What a hell this kind of stupid feature called "section print" (have a
look at "help printing sections") !!!


It is not because it is causing you grief that it is stupid ;-)


What I asked is:

1) in a single section document, is it possible to make an Index at
document 5th page, but showing there "page number = 1" ???


Insert a "Next Page" section break where the Index stars and restart page
numbering at 1.

2) what is the correct / better way to handle/print multi section
documents ?


What code are you using now to print your pages?
In your caese, you mignt ned something like:

p4s1,p1s1, etc.

To make sure that Word prints the proper "Page 1" when you have more than
one "Page 1" in the document, use "pxsy" where p = "page" and s = "section".

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org


  #3   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
danieldc danieldc is offline
external usenet poster
 
Posts: 6
Default VBA code to get page numbers and print multi section documents!

Hello, thanks for all.


It is not because it is causing you grief that it is stupid ;-)


Oh, no, those puppy helpers (dog, mimi, clip, einsten) are so good,
the best ever made since the pre-windows BOB.
Too much I need to search at google to find what could really be
there, easy, at the "CHM" help system that has a search feature worst
than... well...


Insert a "Next Page" section break where the Index stars and restart page
numbering at 1.


Yes, using sections and all that mess, it works, but add some problem
to the code to print the pages (as below)



What code are you using now to print your pages?
In your caese, you mignt ned something like:

p4s1,p1s1, etc.

To make sure that Word prints the proper "Page 1" when you have more than
one "Page 1" in the document, use "pxsy" where p = "page" and s = "section".



Yes, that I had just included at the code, but it makes range property
(wdPrintRangeOfPages) of the Print Dialog (wdDialogFilePrint) really a
long long string...

Is there another way?

  #4   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
Jean-Guy Marcil Jean-Guy Marcil is offline
external usenet poster
 
Posts: 67
Default VBA code to get page numbers and print multi section documents!

danieldc was telling us:
danieldc nous racontait que :

Hello, thanks for all.


It is not because it is causing you grief that it is stupid ;-)


Oh, no, those puppy helpers (dog, mimi, clip, einsten) are so good,
the best ever made since the pre-windows BOB.
Too much I need to search at google to find what could really be
there, easy, at the "CHM" help system that has a search feature worst
than... well...


Insert a "Next Page" section break where the Index stars and restart
page numbering at 1.


Yes, using sections and all that mess, it works, but add some problem
to the code to print the pages (as below)



What code are you using now to print your pages?
In your caese, you mignt ned something like:

p4s1,p1s1, etc.

To make sure that Word prints the proper "Page 1" when you have more
than one "Page 1" in the document, use "pxsy" where p = "page" and s
= "section".



Yes, that I had just included at the code, but it makes range property
(wdPrintRangeOfPages) of the Print Dialog (wdDialogFilePrint) really a
long long string...

Is there another way?


What's wrong with long strings?
Post your code.

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org


  #5   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
danieldc danieldc is offline
external usenet poster
 
Posts: 6
Default VBA code to get page numbers and print multi section documents!



What's wrong with long strings?
Post your code.


Long strings result in error message at print dialog (9105: length
255)



This is the code to call the printer dialog.
The "p" paramter is a list of pages like "4,1,2,3,8,5,6,7,...."
limited to 255.

If I'm going to use the sectionXpageY scheme, then, the string will be
longer!

Thanks for all attention,
yours, Daniel

Private Sub dprint(ByRef p As String)
Dim myd As Dialog
Set myd = Dialogs(wdDialogFilePrint)
myd.Range = wdPrintRangeOfPages
myd.pages = p

myd.FileName = ""
myd.Collate = True
myd.Background = True
myd.PrintToFile = False
myd.PrintZoomColumn = 2
myd.PrintZoomRow = 1
myd.PrintZoomPaperWidth = 0
myd.PrintZoomPaperHeight = 0
End Sub





  #6   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
Jean-Guy Marcil Jean-Guy Marcil is offline
external usenet poster
 
Posts: 67
Default VBA code to get page numbers and print multi section documents!

danieldc was telling us:
danieldc nous racontait que :

What's wrong with long strings?
Post your code.


Long strings result in error message at print dialog (9105: length
255)



This is the code to call the printer dialog.
The "p" paramter is a list of pages like "4,1,2,3,8,5,6,7,...."
limited to 255.

If I'm going to use the sectionXpageY scheme, then, the string will be
longer!


In that case you can only specify about 50 pages in your string.

Thanks for all attention,
yours, Daniel

Private Sub dprint(ByRef p As String)
Dim myd As Dialog
Set myd = Dialogs(wdDialogFilePrint)
myd.Range = wdPrintRangeOfPages
myd.pages = p

myd.FileName = ""
myd.Collate = True
myd.Background = True
myd.PrintToFile = False
myd.PrintZoomColumn = 2
myd.PrintZoomRow = 1
myd.PrintZoomPaperWidth = 0
myd.PrintZoomPaperHeight = 0
End Sub


But if the goal is to print as a book, I guess you are using a printer that
can handle duplex printing, right? In that case I do not understand why you
need to specify each page in a specific order like you are doing.

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org


  #7   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
danieldc danieldc is offline
external usenet poster
 
Posts: 6
Default VBA code to get page numbers and print multi section documents!


But if the goal is to print as a book, I guess you are using a printer that
can handle duplex printing, right? In that case I do not understand why you
need to specify each page in a specific order like you are doing.



If I had a printer that can handle duplex, or if I had found a printer
driver that could handle it, well, of course I would not having all
this trouble about VBA, Word page numbers, sections, and so on...

Using a simple printer, not too much, only capable of print at only
one paper page, then, get all papers, put face down, print again, and
voilą, the 4 pages format A5 in a A4 sheet looks like a book...


Let me ask about the code "doc.PrintOut Range:=wdPrintRangeOfPages,
pages:="4,1,2,3"
Is the "pages" paramter limited to 255 chars?
Well, this could be a solution... not user friendly, as is direct
print, but it's ok...

Thanks!

  #8   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
Jean-Guy Marcil Jean-Guy Marcil is offline
external usenet poster
 
Posts: 67
Default VBA code to get page numbers and print multi section documents!

danieldc was telling us:
danieldc nous racontait que :

But if the goal is to print as a book, I guess you are using a
printer that can handle duplex printing, right? In that case I do
not understand why you need to specify each page in a specific order
like you are doing.



If I had a printer that can handle duplex, or if I had found a printer
driver that could handle it, well, of course I would not having all
this trouble about VBA, Word page numbers, sections, and so on...

Using a simple printer, not too much, only capable of print at only
one paper page, then, get all papers, put face down, print again, and
voilą, the 4 pages format A5 in a A4 sheet looks like a book...


Are you printing on A4?
If so, why can't you just print all the odd pages, then turn the stack
around and print the even pages?
Sorry, but unless you are printing two pages at once on an A5 page and then
folding them to get a "bound" book that only needs to be stapled.... I do no
understand why you are going through all this trouble.

And even if you are doing this folding technique, if you have too many pages
(I'd say more than 16), when you fold them, they do not fit as the inner
pages (7-8,9-10) stick out more than the outer pages (1-2,15-16), you then
have to trim those, thus reducing the outside margin space. So overall, the
look is far from professional.
Also, if you are printing two A4 pages per A4 page, isn't the typo a bit too
small to be readable without causing strain on the reader's eyes?



Let me ask about the code "doc.PrintOut Range:=wdPrintRangeOfPages,
pages:="4,1,2,3"
Is the "pages" paramter limited to 255 chars?


Afraid so.

Well, this could be a solution... not user friendly, as is direct
print, but it's ok...


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org


  #9   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
Ed Ed is offline
external usenet poster
 
Posts: 27
Default VBA code to get page numbers and print multi section documents!

On Mar 13, 7:39 am, "Jean-Guy Marcil" DontEvenTry@NoSpam wrote:
danieldc was telling us:
danieldc nous racontait que :

But if the goal is to print as a book, I guess you are using a
printer that can handle duplex printing, right? In that case I do
not understand why you need to specify each page in a specific order
like you are doing.


If I had a printer that can handle duplex, or if I had found a printer
driver that could handle it, well, of course I would not having all
this trouble about VBA, Word page numbers, sections, and so on...


Using a simple printer, not too much, only capable of print at only
one paper page, then, get all papers, put face down, print again, and
voilą, the 4 pages format A5 in a A4 sheet looks like a book...


Are you printing on A4?
If so, why can't you just print all the odd pages, then turn the stack
around and print the even pages?
Sorry, but unless you are printing two pages at once on an A5 page and then
folding them to get a "bound" book that only needs to be stapled.... I do no
understand why you are going through all this trouble.

And even if you are doing this folding technique, if you have too many pages
(I'd say more than 16), when you fold them, they do not fit as the inner
pages (7-8,9-10) stick out more than the outer pages (1-2,15-16), you then
have to trim those, thus reducing the outside margin space. So overall, the
look is far from professional.
Also, if you are printing two A4 pages per A4 page, isn't the typo a bit too
small to be readable without causing strain on the reader's eyes?



Let me ask about the code "doc.PrintOut Range:=wdPrintRangeOfPages,
pages:="4,1,2,3"
Is the "pages" paramter limited to 255 chars?


Afraid so.

Well, this could be a solution... not user friendly, as is direct
print, but it's ok...


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP

Word MVP site:http://www.word.mvps.org


Don't know if this would work, but it might be a thought worth
exploring:
You didn't show us how you set your string p to set up your pages to
print.
Could you use an array instead, loading each array position with the
"PxSy"
parameter? Then read it backin manageable chunks into your print
dialog?

If you're printing only half of the pages, then turning them over, you
could
use two arrays, one for each half. That might give you more
manageable strings.

Again, just a thought.
Ed

  #10   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
danieldc danieldc is offline
external usenet poster
 
Posts: 6
Default VBA code to get page numbers and print multi section documents!

Hi, thanks for you comments.

Well, the "p" string was made of number pages in a scheme
"4,1,2,3" (then 8,5,6,7, then 12,9,10,11).
Of course I was alread printing first the pages up: 4,1, 8,5,
12,9... Then after the pages down: 2,3, 6,7, 10,11...
The code to generate strings already had done with the limited 255
length, working in chunks.

Now, at a document with sections, the problem is that page "1" could
be not so clear (section 1 page 1, section 2 page 1).
Then I must convert the code to use pageXsectionY scheme at the
strings, and because this, strings get longer and longer.

Unfortunately, the code ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, pages:=p also has the 255 length
limitation at string "p" to pages paramter.

Well... I'm still thinking about it...

----------------------------------------------------------------

To make clear what I'm just printing:
I get a long word document unformatted or bad formatted (no
consistency at use of styles).
Then I have a code to list all paragraphs and styles. This another
code is capable of automatic applying styles to titles1-5, normal and
textblock paragraphs. After this I create an index at page 1.

But, if I want to make some pages to be the "1st/front page" and "last
page", without page numbers, I tried using sections. And with
sections, the print simple scheme goes down! I could also create
another document, easy, but then I must stay with 2 files and not a
single one...

The document is formatted as "page size: A5, 2 pages per sheet,
margins less than 1 inch, font size something like arial/times 10-12".
There is no resizing/zoom done by printer, as the WYSIWYG is perfect
and working well.


Then, you may ask, what do I get printing 2x A5 pages into a single
A4 ?

If the paper upper face has pages 4,1 and the down face has pages 2,3,
when folded it looks like a book, really! )
This is far better to read than a big size A4 page full of text. I can
join all pages and make a small pack (what is not true with big A4/
letter sheets).


Thanks again for all support,
and sorry for my bad english...

Yours, Daniel
from Brazil




  #11   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
Ed Ed is offline
external usenet poster
 
Posts: 27
Default VBA code to get page numbers and print multi section documents!

On Mar 13, 12:29 pm, "danieldc" wrote:
Hi, thanks for you comments.

Well, the "p" string was made of number pages in a scheme
"4,1,2,3" (then 8,5,6,7, then 12,9,10,11).
Of course I was alread printing first the pages up: 4,1, 8,5,
12,9... Then after the pages down: 2,3, 6,7, 10,11...
The code to generate strings already had done with the limited 255
length, working in chunks.

Now, at a document with sections, the problem is that page "1" could
be not so clear (section 1 page 1, section 2 page 1).
Then I must convert the code to use pageXsectionY scheme at the
strings, and because this, strings get longer and longer.

Unfortunately, the code ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, pages:=p also has the 255 length
limitation at string "p" to pages paramter.

Well... I'm still thinking about it...

----------------------------------------------------------------

To make clear what I'm just printing:
I get a long word document unformatted or bad formatted (no
consistency at use of styles).
Then I have a code to list all paragraphs and styles. This another
code is capable of automatic applying styles to titles1-5, normal and
textblock paragraphs. After this I create an index at page 1.

But, if I want to make some pages to be the "1st/front page" and "last
page", without page numbers, I tried using sections. And with
sections, the print simple scheme goes down! I could also create
another document, easy, but then I must stay with 2 files and not a
single one...

The document is formatted as "page size: A5, 2 pages per sheet,
margins less than 1 inch, font size something like arial/times 10-12".
There is no resizing/zoom done by printer, as the WYSIWYG is perfect
and working well.

Then, you may ask, what do I get printing 2x A5 pages into a single
A4 ?

If the paper upper face has pages 4,1 and the down face has pages 2,3,
when folded it looks like a book, really! )
This is far better to read than a big size A4 page full of text. I can
join all pages and make a small pack (what is not true with big A4/
letter sheets).

Thanks again for all support,
and sorry for my bad english...

Yours, Daniel
from Brazil


Daniel, it would seem that if
Of course I was alread printing first the pages up: 4,1, 8,5,
12,9... Then after the pages down: 2,3, 6,7, 10,11...

then you simply need to print smaller batches of pages.
Using "p11,s11-p11,s11;" you have 14 characters per print
range. That gives you batches of 18 pages per string
(252 characters total). Running the print command a few
more times may take extra time, but if you've got a
small basic printer, it may be glad for a bit of a break!

That's all I've got to think of. Good luck.
Ed

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide page numbers in Section 1 continue Section 2 normally [email protected] Page Layout 1 May 22nd 06 10:55 PM
Footnotes- How set page numbers by section, and ony that section TGilboy Page Layout 1 March 30th 06 05:18 AM
How to print page numbers in documents Ruby Microsoft Word Help 1 November 27th 05 09:24 PM
How do I remove page numbers from section 1 of a 2 section documen Robin Microsoft Word Help 4 February 18th 05 12:05 AM
How do I print page numbers in only 1 section of a multi-section . moniblues Microsoft Word Help 1 January 12th 05 12:57 AM


All times are GMT +1. The time now is 09:33 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"