A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Skip a constant number of records



 
 
Thread Tools Display Modes
  #1  
Old August 17th 06, 06:32 PM posted to microsoft.public.word.mailmerge.fields
R Alapatt
external usenet poster
 
Posts: 6
Default Skip a constant number of records

I have a data file that lists all the data one below the other. But each
record is a constant number of lines. I need to pick up the address which is
on 5 lines starting every 25th line.
Ads
  #2  
Old August 17th 06, 09:09 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,832
Default Skip a constant number of records

It is not really practical to try and do that simply with a mail merge. It
would be far better to run a macro over the data source and extract the
necessary information.

What is the data source?

If it were a Word document, you may be able to use the Convert Text to Table
facility under the Table menu to convert the data to a 24 column table and
the insert a row at the top of the table and insert field names into that
row and then just insert the fields from the first five columns into a mail
merge main document.

There are other ways, but the best way will be dependent upon the data
source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
I have a data file that lists all the data one below the other. But each
record is a constant number of lines. I need to pick up the address which
is
on 5 lines starting every 25th line.



  #3  
Old August 22nd 06, 10:12 PM posted to microsoft.public.word.mailmerge.fields
R Alapatt
external usenet poster
 
Posts: 6
Default Skip a constant number of records

Thank you for your response I did not get a notification, hence my entry
again.

My data source is a text file. Each record is 1510 lines. The address is
lines 110 to 115. When you say run a marco ( i am not familiar with macro)
will it create another file with just the address info?



"Doug Robbins - Word MVP" wrote:

It is not really practical to try and do that simply with a mail merge. It
would be far better to run a macro over the data source and extract the
necessary information.

What is the data source?

If it were a Word document, you may be able to use the Convert Text to Table
facility under the Table menu to convert the data to a 24 column table and
the insert a row at the top of the table and insert field names into that
row and then just insert the fields from the first five columns into a mail
merge main document.

There are other ways, but the best way will be dependent upon the data
source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
I have a data file that lists all the data one below the other. But each
record is a constant number of lines. I need to pick up the address which
is
on 5 lines starting every 25th line.




  #4  
Old August 23rd 06, 04:25 AM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,832
Default Skip a constant number of records

Is each record 50 lines as mentioned in your second posting, or 1510 lines
as mentioned in this one. It will make a difference to the code that you
will need in the macro.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
Thank you for your response I did not get a notification, hence my entry
again.

My data source is a text file. Each record is 1510 lines. The address is
lines 110 to 115. When you say run a marco ( i am not familiar with
macro)
will it create another file with just the address info?



"Doug Robbins - Word MVP" wrote:

It is not really practical to try and do that simply with a mail merge.
It
would be far better to run a macro over the data source and extract the
necessary information.

What is the data source?

If it were a Word document, you may be able to use the Convert Text to
Table
facility under the Table menu to convert the data to a 24 column table
and
the insert a row at the top of the table and insert field names into that
row and then just insert the fields from the first five columns into a
mail
merge main document.

There are other ways, but the best way will be dependent upon the data
source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
I have a data file that lists all the data one below the other. But
each
record is a constant number of lines. I need to pick up the address
which
is
on 5 lines starting every 25th line.






  #5  
Old August 25th 06, 02:17 PM posted to microsoft.public.word.mailmerge.fields
R Alapatt
external usenet poster
 
Posts: 6
Default Skip a constant number of records

It is 1510 lines. the Data is from another software that uses mail merge
(wordperfect) to printout some letters. We need to print out some labels
using the same data.

"Doug Robbins - Word MVP" wrote:

Is each record 50 lines as mentioned in your second posting, or 1510 lines
as mentioned in this one. It will make a difference to the code that you
will need in the macro.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
Thank you for your response I did not get a notification, hence my entry
again.

My data source is a text file. Each record is 1510 lines. The address is
lines 110 to 115. When you say run a marco ( i am not familiar with
macro)
will it create another file with just the address info?



"Doug Robbins - Word MVP" wrote:

It is not really practical to try and do that simply with a mail merge.
It
would be far better to run a macro over the data source and extract the
necessary information.

What is the data source?

If it were a Word document, you may be able to use the Convert Text to
Table
facility under the Table menu to convert the data to a 24 column table
and
the insert a row at the top of the table and insert field names into that
row and then just insert the fields from the first five columns into a
mail
merge main document.

There are other ways, but the best way will be dependent upon the data
source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
I have a data file that lists all the data one below the other. But
each
record is a constant number of lines. I need to pick up the address
which
is
on 5 lines starting every 25th line.






  #6  
Old August 25th 06, 09:47 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,832
Default Skip a constant number of records

I don't have a suitable file on which to try this, but if you run a macro
containing the following code when the data document is the activedocument,
it should create a new document with the details of each address in the
cells of a 5 column table. You can then insert a row at the top of the
table into which you insert names to be used for each of the merge fields.

Dim Source As Document, Target As Document
Dim i As Long, j As Long, numrecs As Long
Dim data As Range, record As String
Set Source = ActiveDocument
Set Target = Documents.Add
numrecs = Source.Paragraphs.Count / 1510
For j = 1 To numrecs
For i = 1 To 109 'Delete the first 109 lines from each record
Source.Paragraphs(i).Range.Delete
Next i
record = ""
'Create a string containing the data from the next five lines
For i = 1 To 4
Set data = Source.Paragraphs(i).Range
data.End = data.End - 1
record = record & data.Text & vbTab
Source.Paragraphs(i).Range.Delete
Next i
Set data = Source.Paragraphs(1).Range
data.End = data.End - 1
record = record & data
Target.Range.InsertAfter record & vbCr
Source.Paragraphs(1).Range.Delete
For i = 1 To 1400
Source.Paragraphs(i).Range.Delete 'Delete the remaining lines in
each record
Next i
Next j 'Repeat the process for the next record
Source.Close wdDoNotSaveChanges 'Close the source document without saving it
as all of the data from it has been deleted.
Target.Range.ConvertToTable Separator:=vbTab, NumColumns:=5



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
It is 1510 lines. the Data is from another software that uses mail merge
(wordperfect) to printout some letters. We need to print out some labels
using the same data.

"Doug Robbins - Word MVP" wrote:

Is each record 50 lines as mentioned in your second posting, or 1510
lines
as mentioned in this one. It will make a difference to the code that you
will need in the macro.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
Thank you for your response I did not get a notification, hence my
entry
again.

My data source is a text file. Each record is 1510 lines. The address
is
lines 110 to 115. When you say run a marco ( i am not familiar with
macro)
will it create another file with just the address info?



"Doug Robbins - Word MVP" wrote:

It is not really practical to try and do that simply with a mail
merge.
It
would be far better to run a macro over the data source and extract
the
necessary information.

What is the data source?

If it were a Word document, you may be able to use the Convert Text to
Table
facility under the Table menu to convert the data to a 24 column table
and
the insert a row at the top of the table and insert field names into
that
row and then just insert the fields from the first five columns into a
mail
merge main document.

There are other ways, but the best way will be dependent upon the data
source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"R Alapatt" wrote in message
...
I have a data file that lists all the data one below the other. But
each
record is a constant number of lines. I need to pick up the address
which
is
on 5 lines starting every 25th line.








 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
page number positioning and format tinaa Page Layout 3 February 4th 06 12:38 AM
Is there a limit of words you can put in tables? lkwink Tables 4 October 16th 05 03:15 PM
How do I insert chapter number with page number in footer? Joan Microsoft Word Help 4 May 9th 05 04:00 PM
Want to Repeat Records certain number of times davis Mailmerge 2 February 16th 05 08:21 PM
Maximum number of pages in a word document Travis75 Formatting Long Documents 5 January 27th 05 05:03 AM


All times are GMT +1. The time now is 12:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright 2004-2021 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.