Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
cjobes
 
Posts: n/a
Default How can I generate additional pages

Hi everybody,

I'm stuck with a problem. We have a 1-page template that has 80 costum
labels on it. I wrote a macro in VB that will fill in the info as needed. I
am trying to create a continues number scheme based on the user imput. The
VB script works fine for the first page but if the user needs more than 80
numbers I can't find a way to add a second page. When I issue a wdPageBreak
it's just an empty space without the labels.

Can anybody tell me what I need to do to get a second, third, etc page with
the labels?

Thanks for your help
Claus

Below is the code that I'm using

Dim Client As String
Dim stNum As Integer
Dim test As String
Dim pages As Integer



Selection.HomeKey Unit:=wdStory
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Client = InputBox("Please enter Client name")
stNum = CInt(InputBox("Please enter 1st client file number"))
pages = CInt(InputBox("Please enter the number of pages"))
Client = Client + "-"


Selection.HomeKey Unit:=wdStory

i = stNum
While pages 0
While i stNum + 80
If i 10 Then test = "00000"
If i 10 And i 100 Then test = "0000"
If i 100 And i 1000 Then test = "000"
If i 1000 And i 10000 Then test = "00"
If i 999999 Then test = "0"
Selection.TypeText Text:=Client + test
Selection.TypeText Text:=CStr(i)
Selection.MoveRight Unit:=wdCharacter, Count:=2
i = i + 1

Wend
Selection.InsertBreak Type:=wdPageBreak
pages = pages - 1
Wend


End Sub


 
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
Page Numbering - Insertion Pages Greg Pearson Microsoft Word Help 4 February 14th 05 05:53 PM
Printing Page Ranges with page numbers i-iv then 1-23 for 27 total Scott Page Layout 2 February 9th 05 02:49 AM
Number of pages excluding content pages Number of pages excluding content pages Microsoft Word Help 4 January 11th 05 02:21 PM
Printing single pages or a range of pages Craig Mailmerge 1 December 13th 04 01:51 AM
Can I add additional pages after my endnotes in one document? cuencadillo Page Layout 3 November 30th 04 05:30 PM


All times are GMT +1. The time now is 02:51 PM.

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"