Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to use Outlook template in MS Access SendObject maco

Posted on 2014-08-27
3
Medium Priority
?
108 Views
Last Modified: 2015-03-17
Because the SendObject's message text argument is limited to 255 characters, I would like to utilize the template argument; however, when I enter the path for my Outlook template file ("S:\MainFolder\SubFolder\Untitled.oft"), the macro halts. What am I doing wrong? Much thanks in advance!
0
Comment
Question by:jaguar5554
3 Comments
 
LVL 54

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 40289661
HI,

pls try
Sub macro2()

Dim oOutlook As Object
Dim oMailItem As Object

Set oOutlook = CreateObject("Outlook.Application")
Set oMailItem = oOutlook.CreateItem(0)

Set oMailItem = oOutlook.CreateItemFromTemplate("S:\MainFolder\SubFolder\Untitled.oft")


strEmail = "test@mysite.com"
strSubject = "Test"
strBody = "Test Body"

oMailItem.To = strEmail
oMailItem.Subject = strSubject
oMailItem.Body = strBody
oMailItem.Display ' Or
'oMailItem.Send

Set oOutlook = Nothing
Set oMailItem = Nothing

End Sub

Open in new window

Regards
0
 
LVL 85
ID: 40290097
To be clear: You cannot define a Template when you use SendObject. You must use Outlook Automation, as RGonzo has illustrated.

I find that using vbMAPI from www.everythingaccess.com to be the simplest and most reliable way to handle things like this. Costs about $90 USD, but is well worth the cost. Note I have no affiliation with the company except as a satisfied client.
0
 

Author Comment

by:jaguar5554
ID: 40671046
Hello, I must have missed the expert responses to my inquiry -- my sincere apologies! Although we worked around the issue and no longer require to send object -- I will test the suggestion in case the need comes up in a different or new project. Thanks much!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

810 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