Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / January 2007

Tip: Looking for answers? Try searching our database.

extracting address from a word document and merging them to label

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Freida - 30 Jan 2007 17:30 GMT
I have a word document with several sections.  At the begining of each
section, there is a vendor name and address.  I want to creat a label merge
that copies the addresses contained at the beg. of each section onto the
labels.  Is this possible?
Doug Robbins - Word MVP - 30 Jan 2007 18:21 GMT
It is possible to do such a thing using Visual Basic.  For a document with
only several sections, it is probably not worth the effort of creating the
necessary macro, unless it is something that you have to do on a regular
basis.

To give any specific information on how to go about it, it would be
necessary for you to provide additional information on how the address
appears at the beginning of each section of the document.

Signature

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

>I have a word document with several sections.  At the begining of each
> section, there is a vendor name and address.  I want to creat a label
> merge
> that copies the addresses contained at the beg. of each section onto the
> labels.  Is this possible?
Freida - 30 Jan 2007 20:55 GMT
The 1st  4 lines of each section include the vendor name and the address.  
This is something that will need to be done on a regular basis, I made need
the macro for this one.  At any give time this doc.  Can have anywhere from
10 to 40 sections depending on how often the report is ran.

> It is possible to do such a thing using Visual Basic.  For a document with
> only several sections, it is probably not worth the effort of creating the
[quoted text clipped - 10 lines]
> > that copies the addresses contained at the beg. of each section onto the
> > labels.  Is this possible?
Doug Robbins - Word MVP - 31 Jan 2007 04:51 GMT
And is each line a separate paragraph ending in a ¶ (when you click on the
Show/Hide button (¶))?

If that is the case, this code should do it:

Dim i As Long, j As Long
Dim source As Document, target As Document
Dim arange As Range, srange As Range
Set source = ActiveDocument
Set target = Documents.Add
With source
   For i = 1 To .Sections.Count
       For j = 1 To 3
           Set srange = .Sections(i).Range
           Set arange = srange.Paragraphs(j).Range
           arange.End = arange.End - 1
           target.Range.InsertAfter arange & vbTab
       Next j
       Set arange = srange.Paragraphs(4).Range
       target.Range.InsertAfter arange
   Next i
End With

Signature

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

> The 1st  4 lines of each section include the vendor name and the address.
> This is something that will need to be done on a regular basis, I made
[quoted text clipped - 20 lines]
>> > the
>> > labels.  Is this possible?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.