Reply
 
Thread Tools Display Modes
  #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


  #2   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

The usual way to create multiple sheets of labels is with a mail merge.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"cjobes" wrote in message
...
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



  #3   Report Post  
cjobes
 
Posts: n/a
Default

Well, I don't see how I could implement the code with mail merge. Any idea?

"Suzanne S. Barnhill" wrote in message
...
The usual way to create multiple sheets of labels is with a mail merge.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup

so
all may benefit.

"cjobes" wrote in message
...
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





  #4   Report Post  
Daiya Mitchell
 
Posts: n/a
Default

One option:
Forget about your macro.

Create a list in Excel numbered 1-80 (plus whatever your custom data is).
Use that as the data source for the mail merge.


On 5/18/05 7:38 AM, "cjobes" wrote:

Well, I don't see how I could implement the code with mail merge. Any idea?

"Suzanne S. Barnhill" wrote in message
...
The usual way to create multiple sheets of labels is with a mail merge.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup

so
all may benefit.

"cjobes" wrote in message
...
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






  #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





  #6   Report Post  
cjobes
 
Posts: n/a
Default

Thanks Sue,

I would have to be able to do this within the VB Script. Any idea how I can
do this?

Claus

"Sue" wrote in message
...
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





  #7   Report Post  
cjobes
 
Posts: n/a
Default

I don't see how this would work. The user is asked to enter the client ID,
the starting number and the number of pages ( or alternately the ending
number). This can be from 189 to 833 or any other combination. If the user
needs 800 continues numbers the script would have to create 10 pages.

Basically I'm looking for a script methode to create additional pages on the
fly with those 80 labels on it.

Claus


"Daiya Mitchell" wrote in message
.. .
One option:
Forget about your macro.

Create a list in Excel numbered 1-80 (plus whatever your custom data is).
Use that as the data source for the mail merge.


On 5/18/05 7:38 AM, "cjobes" wrote:

Well, I don't see how I could implement the code with mail merge. Any

idea?

"Suzanne S. Barnhill" wrote in message
...
The usual way to create multiple sheets of labels is with a mail merge.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup
so
all may benefit.

"cjobes" wrote in message
...
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








  #8   Report Post  
Daiya Mitchell
 
Posts: n/a
Default

You should go ask in a newsgroup with Programming or VBA in the name, as
well as Word. You will get better code help there than here.


On 5/18/05 8:19 PM, "cjobes" wrote:

I don't see how this would work. The user is asked to enter the client ID,
the starting number and the number of pages ( or alternately the ending
number). This can be from 189 to 833 or any other combination. If the user
needs 800 continues numbers the script would have to create 10 pages.

Basically I'm looking for a script methode to create additional pages on the
fly with those 80 labels on it.

Claus




  #9   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Cjobes,

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.

Assuming this is NOT mail merge (can't be sure from the discussion)...

Insert a SEQ field in each label on the page. In the very first one, add the
\r switch so that you can set the starting number. Your script can either
edit this number in the field code. Or you can set the starting number in a
custom document property and embed a DocProperty field code into the SEQ
field code.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #10   Report Post  
cjobes
 
Posts: n/a
Default

Cindy,

Thanks for answering. Here is a quick sum of what I have and what I'm trying
to do:

I have a one-page document with 80 boxes. I added the following code (see
below) to it and then made it a DOT file. What I would like to get to is
giving the user a chance of putting not only the starting number but also
the ending number into a third box. I would then change the code to call a
second, third, fourth page after each 80 numbers. What I'm looking for is
help how to add as many pages in the code as needed with those 80 boxes.
When I issue a wdPageBreak only a blank page comes up. I'm a DB and App guy
and haven't work much with Word automation.

Here is the code again:

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

Thanks for your help.

Claus


"Cindy M -WordMVP-" wrote in message
news:VA.0000adb8.006c102f@speedy...
Hi Cjobes,

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.

Assuming this is NOT mail merge (can't be sure from the discussion)...

Insert a SEQ field in each label on the page. In the very first one, add

the
\r switch so that you can set the starting number. Your script can either
edit this number in the field code. Or you can set the starting number in

a
custom document property and embed a DocProperty field code into the SEQ
field code.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)





  #11   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Cjobes,

What I'm looking for is
help how to add as many pages in the code as needed with those 80 boxes.
When I issue a wdPageBreak only a blank page comes up. I'm a DB and App guy
and haven't work much with Word automation.

So, I figure you have no problems calculating how many additional pages you
need :-)? Just subtract the start number from the end number, then divide by
80; and then the result minus one...

Have you done some experimenting, manually, to determine if you get a
desirable result if you, for example, insert a manual page break, copy the
table (labels) and paste on a new page? Or does simply copying/pasting the
label sheet at the end of the first set of labels generate what you need?

Anyway, as soon as you determine the best way...

Select the current page of labels and create an AutoText entry from them. The
AutoText needs to be saved in a template. All you need to do in your code,
then, is insert the AutoText (and any required page break kind of thing) in a
loop as many times as you need additional pages. This is much more reliable
than trying to copy/paste in the code.

And I still advise you to insert the SEQ field into the label pages, so that
you don't need to worry about doing the numbering in your code.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #12   Report Post  
cjobes
 
Posts: n/a
Default

Thanks Cindy (Dankeschoen)

I will experiment with this a bit further. I visited your site and had a
look at the SEQ stuff. When you look at my code you will see that the
numbering has to be in a certain way. It always has to be 6 ditgets with the
right number of leading 0s. This is very easy to do in the code and I get
away with a single field.

Where my problem starts is generating those additional pages on the fly and
moving the curser to the right place. I don't know the code for "select
all" - "copy" - "page break" -"paste" etc and to assure that the page after
the page break has the same margin set. Given that I don't do bobbin-lace I
will spend some time over the weekend to play with it and see if I find
something on your site to help.

Thanks again for answering...

Herzliche Gruesse in die Schweiz,

Claus

"Cindy M -WordMVP-" wrote in message
news:VA.0000adc6.00805881@speedy...
Hi Cjobes,

What I'm looking for is
help how to add as many pages in the code as needed with those 80 boxes.
When I issue a wdPageBreak only a blank page comes up. I'm a DB and App

guy
and haven't work much with Word automation.

So, I figure you have no problems calculating how many additional pages

you
need :-)? Just subtract the start number from the end number, then divide

by
80; and then the result minus one...

Have you done some experimenting, manually, to determine if you get a
desirable result if you, for example, insert a manual page break, copy the
table (labels) and paste on a new page? Or does simply copying/pasting the
label sheet at the end of the first set of labels generate what you need?

Anyway, as soon as you determine the best way...

Select the current page of labels and create an AutoText entry from them.

The
AutoText needs to be saved in a template. All you need to do in your code,
then, is insert the AutoText (and any required page break kind of thing)

in a
loop as many times as you need additional pages. This is much more

reliable
than trying to copy/paste in the code.

And I still advise you to insert the SEQ field into the label pages, so

that
you don't need to worry about doing the numbering in your code.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



  #13   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Cjobes,

Where my problem starts is generating those additional pages on the fly and
moving the curser to the right place. I don't know the code for "select
all" - "copy" - "page break" -"paste" etc and to assure that the page after
the page break has the same margin set. Given that I don't do bobbin-lace I
will spend some time over the weekend to play with it and see if I find
something on your site to help.

1. Please do experiement manually, along the lines I suggested.

2. Copy/paste is never a good idea, if there's an alternative. If an AutoText
entry won't work for some reason, then the better approach is to use
.Range.FormattedText to bring the table into the new position

3. Cursor position shouldn't matter; you should avoid working with the
Selection object. Use Range, instead. Here's a bit of pseudocode (meaning
it's off the top of my head) that illustrates how you'd "copy" the first
table in a document to the very end of the document:

Dim rngTable as Word.Range
Dim rngTarget as Word.Range

Set rngTable = ActiveDocument.Tables(1).Range
Set rngTarget = ActiveDocument.Range
rngTarget.Collapse wdCollapseEnd
rngTarget.FormattedText = rngTable.FormattedText

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #14   Report Post  
cjobes
 
Posts: n/a
Default

Cindy,

Thanks, that worked like a charme. I added some code to calculate how many
pages are needed, run a loop to create them and then insert the numbers.

Claus

"Cindy M -WordMVP-" wrote in message
news:VA.0000aded.00ef4134@speedy...
Hi Cjobes,

Where my problem starts is generating those additional pages on the fly

and
moving the curser to the right place. I don't know the code for "select
all" - "copy" - "page break" -"paste" etc and to assure that the page

after
the page break has the same margin set. Given that I don't do

bobbin-lace I
will spend some time over the weekend to play with it and see if I find
something on your site to help.

1. Please do experiement manually, along the lines I suggested.

2. Copy/paste is never a good idea, if there's an alternative. If an

AutoText
entry won't work for some reason, then the better approach is to use
Range.FormattedText to bring the table into the new position

3. Cursor position shouldn't matter; you should avoid working with the
Selection object. Use Range, instead. Here's a bit of pseudocode (meaning
it's off the top of my head) that illustrates how you'd "copy" the first
table in a document to the very end of the document:

Dim rngTable as Word.Range
Dim rngTarget as Word.Range

Set rngTable = ActiveDocument.Tables(1).Range
Set rngTarget = ActiveDocument.Range
rngTarget.Collapse wdCollapseEnd
rngTarget.FormattedText = rngTable.FormattedText

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



  #15   Report Post  
cjobes
 
Posts: n/a
Default

Cindy,

Thanks for your code sample. It worked great. I added a counter and now the
code generates exactly the right number of pages and inserts the text into
the boxes.

Claus


"Cindy M -WordMVP-" wrote in message
news:VA.0000aded.00ef4134@speedy...
Hi Cjobes,

Where my problem starts is generating those additional pages on the fly

and
moving the curser to the right place. I don't know the code for "select
all" - "copy" - "page break" -"paste" etc and to assure that the page

after
the page break has the same margin set. Given that I don't do

bobbin-lace I
will spend some time over the weekend to play with it and see if I find
something on your site to help.

1. Please do experiement manually, along the lines I suggested.

2. Copy/paste is never a good idea, if there's an alternative. If an

AutoText
entry won't work for some reason, then the better approach is to use
Range.FormattedText to bring the table into the new position

3. Cursor position shouldn't matter; you should avoid working with the
Selection object. Use Range, instead. Here's a bit of pseudocode (meaning
it's off the top of my head) that illustrates how you'd "copy" the first
table in a document to the very end of the document:

Dim rngTable as Word.Range
Dim rngTarget as Word.Range

Set rngTable = ActiveDocument.Tables(1).Range
Set rngTarget = ActiveDocument.Range
rngTarget.Collapse wdCollapseEnd
rngTarget.FormattedText = rngTable.FormattedText

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)





  #16   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Claus,

Thanks for your code sample. It worked great. I added a counter and now the
code generates exactly the right number of pages and inserts the text into
the boxes.

Glad you're finally up and running :-)

Cindy Meister

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
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 03:03 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"