Solved

Using Email Templates and populating Bookmarks from Access

Posted on 2008-10-02
9
986 Views
Last Modified: 2013-11-27
Deep breath and time for my first question on E-E
I am developing a database in Access 2007. I would like to be able to select data from the db and use it to populate bookmarks in an Outlook Template. Is this possible. I have managed to send straightforward emails from Access and have previously managed to populate a Word document from Access using bookmarks. I would now like to use an email template and somehow customise it with data from the db. Is this possible? If so are there any useful code snippets to help me. I currently use VBA and open an instance of MS Outlook to send emails.

Many thanks
0
Comment
Question by:stillers1994
  • 5
  • 4
9 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22633910

"Outlook Template"
Which kind please?
Email?
Contact?
Meeting?
Appointment?
Note?

Are you asking, or do you know for a fact that Outlook objects even have a .Bookmark property?

JeffCoachman
0
 

Author Comment

by:stillers1994
ID: 22634117
Sorry - about lack of info
I have only just started using things like Bookmarks. I used them to successfully populate a Word Doc from Access 2007 with items from the DB (using vba). So I then looked in Outlook  2007 at Email Templates,  and saw that you can similarly add bookmarks to the .oft template so my question is can you use vb code to open the email template from Access using vb code, and populate the bookmarked items before sending out the email.
I hope that makes sense
Many thanks
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22634496
stillers1994,

You can "Populate" the email fields by using the fairly standard code found here:
http://support.microsoft.com/kb/161088

For example , you would simply substitute:
              Set objOutlookRecip = .Recipients.Add([YourEmailRecipientField])
For
              Set objOutlookRecip = .Recipients.Add("Nancy Davolio")

Similarly to fill in a subject into the email, form an Access field use:
             .Subject = [YourSubjectField]
...Instead of
             .Subject = "This is an Automation test with Microsoft Outlook"


This is the standard way of doing this, so I can't really see the need for "bookmarks" per se.
;-)

JeffCoachman
0
 

Author Comment

by:stillers1994
ID: 22634668
Thankyou for your quick reply.
 I know I can add the recipient, subject etc but what  I actually wanted to do customise is the actual .body part  of the email.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22634903
Then please explain in detail what you mean by "customise".

AFAIK, you can use this:
.body=[YourCustomBodyField]
0
 

Author Comment

by:stillers1994
ID: 22635058
I would like to set up a 'pretty' email that will be sent out to customers, and within this email, I would like to drop in personalised information concerning for example particular project information and product details. Now I could set up a Word document and drop this info into the bookmarks and then email this as an attachment but I would prefer to use the email body itself rather than have someone have to open an attachment.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 22635581
stillers1994,

Then you can use the .HTMLBody property.

Using this you can insert HTLM formatted text, or an image into an email body.

For example:
        .HTMLBODY = "<HTML><b><u>ADDRESS</b></u><br></br>123 broad street<br></br><br></br></HTML>"

Insert an image:
  <img SRC=C:\File.jpg>

JeffCoachman
0
 

Author Closing Comment

by:stillers1994
ID: 31502364
Yes that will do it - would have preferred using a kind of Email template with 'drop in fields' that could be maintained by someone else but this method will do for now. Many thanks for your help
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22657916
Great.

Besides this site, here is a site that is totally dedicated to Outlook/Exchange.
http://www.outlookcode.com/

JeffCoachman
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now