View Single Post
  #5   Report Post  
Sue
 
Posts: n/a
Default

Can you edit the template? If you can, do a SelectAll to highlight the 80
labels, hit copy, then put a page break in so you are on the second page and
paste in the 80 labels again, you can create as many pages of the same label
as you want. I know this is primitive, but it does work. Hope it will help.

"cjobes" wrote:

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