Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
Thread | Forum | |||
Converting Address List in Word to Excel Spreadsheet | Microsoft Word Help | |||
How do I get mail merge address list into Excel spreadsheet? | Mailmerge | |||
How can I Convert Address List (Word) to Excel Spreadsheet? | Microsoft Word Help | |||
Importing an excel document (address list) to a Word address book | Mailmerge | |||
Mailmerge with Excel spreadsheet switches columns to display | Mailmerge |