tell application "Microsoft Word"
set theDoc to active document
set theRecipient to "johnbrown25311@gmail.com"
set theSubject to "Merged document"
set theBody to "Please find the merged document attached."
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
tell newMessage
make new recipient with properties {email address:{address:theRecipient}}
open -- Display the email for review
end tell
end tell
end tell
This applescript runs perfectly.
The problem is that I need to use a Mac Word mergefield named "email" instead of hard coding the email address
I have tried
set theRecipient to mergefield:email
set theRecipient to {mergefield:email}
set theRecipient to mergefield:"email"
set theRecipient to {mergefield:"email"}
I cannot find the correct syntax to refer to a mergefield named "email" in the current word document.
In every case I get a 'variable not recognized' or similar error