General discussion
January 26, 2001 at 04:55 AM
dthomas

Automating Word from Outlook

by dthomas . Updated 25 years, 5 months ago

This is my first attempt at an Outlook Macro.

Sub OutlookWordMerge()
Dim oOutlook As Outlook.Application
Dim oWord As Word.Application
Set oOutlook = CreateObject(?Outlook.Application?)
Set oWord = CreateObject(?Word.Application?)
Dim oContact As ContactItem
Dim oContacts As Outlook.Selection
Dim oDoc As Word.Document
Set oContacts = oOutlook.ActiveExplorer.Selection
For Each oContact In oContacts
Set oDoc =
oWord.Documents.Add(?C:\WinNT\Profiles\Dave\Application
Data\Microsoft\Templates\Letter1.dot?)
oDoc.Bookmarks(?Name?).Range.Text = oContact.FullName
Next
End Sub

I have a template called letter1.dot with a bookmark called Name.
This does not produce any errors but does not produce any documents
whether
I have Word opened or closed.
What have I missed

This discussion is locked

All Comments