Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dfoxwe dfoxwe is offline
external usenet poster
 
Posts: 1
Default Mailmerge an address book with an Excel spreadsheet

Is it possible to merge an Outlook Address list with an Excel spreadsheet? I
would like to pull a number from a list of numbers and match that to an
individual email address. The goal is to have an address merged with a unique
number.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Mailmerge an address book with an Excel spreadsheet

Word can only use a single flat datasource for mail merge, so you would need
to do this in several steps. In Outlook, you can use FileImport and Export
to export the contacts to an Excel Spreadsheet. Then you could assign the
required numbers each row of data in that sheet and then use that as the
data source.

If however, it is just a sequential number that you want to insert into each
merged record, you could use your Outlook contacts and include a MergeRec
field.

See the "Mailmerge from Outlook" item on fellow MVP Graham Mayor's website
at:
http://www.gmayor.com/mailmerge_from_outlook.htm


--
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, originally posted via msnews.microsoft.com
"dfoxwe" wrote in message
...
Is it possible to merge an Outlook Address list with an Excel spreadsheet?
I
would like to pull a number from a list of numbers and match that to an
individual email address. The goal is to have an address merged with a
unique
number.


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Mailmerge an address book with an Excel spreadsheet

It should be possible to add the relevant number to a custom field in the
Outlook record and merge directly from Outlook.

For example if you copy the Excel columns containing the e-mail addresses
and the numbers to a two column Word table (addresses in col 1) and save
that as a Word document (here "d:\My Documents\Test\email table.docx"), the
following *Outlook* Macro will add the relevant numbers to the Outlook
records that contain the e-mail addresses in the Email1Address field of
Outlook. The numbers will be stored in the Outlook field User3. This field
can then be included in your mail merge.

It should also be possible to lookup the entries directly from the Excel
table with a similar macro, but as I am less familiar with the Excel object
model I will stick to Word.


Public Sub AddNumberToUser3()
'Create this macro in OUTLOOK!
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objContactFolder As Outlook.MAPIFolder
Dim objContact As Outlook.ContactItem
Dim objItems As Outlook.Items
Dim obj As Object
Dim oNum As Range
Dim strDoc As String
Dim oCell As Range
strDoc = "d:\My Documents\Test\email table.docx"
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err Then
Set wdApp = CreateObject("Word.Application")
End If
Set wdDoc = wdApp.Documents.Open(strDoc)
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set objContactFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objItems = objContactFolder.Items
For Each obj In objItems
If obj.Class = olContact Then
Set objContact = obj
With objContact
For i = 1 To wdDoc.Tables(1).Rows.Count
Set oCell = wdDoc.Tables(1).Cell(i, 1).Range
oCell.End = oCell.End - 1
If oCell.Text = .Email1Address Then
Set oNum = wdDoc.Tables(1).Cell(i, 2).Range
oNum.End = oNum.End - 1
.User3 = oNum.Text
.Save
Exit For
End If
Next i
End With
End If
Err.Clear
Next
Set objOL = Nothing
Set objNS = Nothing
Set obj = Nothing
Set objContactFolder = Nothing
Set objContact = Nothing
Set wdDoc = Nothing
Set wdApp = Nothing
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dfoxwe wrote:
Is it possible to merge an Outlook Address list with an Excel
spreadsheet? I would like to pull a number from a list of numbers and
match that to an individual email address. The goal is to have an
address merged with a unique number.



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
Converting Address List in Word to Excel Spreadsheet Andrea Microsoft Word Help 2 June 28th 06 08:47 PM
How do I get mail merge address list into Excel spreadsheet? Jimbo Mi Mailmerge 2 October 11th 05 06:13 AM
How can I Convert Address List (Word) to Excel Spreadsheet? mickeyfinz Microsoft Word Help 4 October 4th 05 05:54 AM
Importing an excel document (address list) to a Word address book Sherry Lee Mailmerge 3 August 19th 05 01:17 AM
Mailmerge with Excel spreadsheet switches columns to display SharronTucker Mailmerge 1 August 9th 05 06:31 PM


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

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"