PDA

View Full Version : Outlook Access from Word



bradh_nz
09-19-2007, 03:19 AM
Hello, I have the below VBA to send emails from work using the mail merge function. This runs fine when manually done but when I run the Macro it prompts me for access to Outlooks email address book. This is not required as the email addresses are contained within word.

Is there anyway to supress this message?

Sub Send_Email_Updates()
'
' Macro1 Macro
' Macro recorded 19/09/2007 by brad.hancock
'
With ActiveDocument.MailMerge
.Destination = wdSendToEmail
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
End Sub


Thanks
Brad

fionabolt
09-19-2007, 05:17 AM
You will need to have stored the email address in a merge field. In this example called "Email"
With Documents("FormLetter.doc").MailMerge .MailAddressFieldName = "Email" .MailSubject = "something appropriate" .Destination = wdSendToEmail .ExecuteEnd With