[AccessD] Outlook automation - use a template for a message

Doug Murphy dw-murphy at cox.net
Tue Jan 24 12:23:26 CST 2006


Hello Erwin,

I was not aware of RTF being dropped.  I thought there was some pretty stiff
resistance to using html formated e-mail.  I tried a quick test using a
simple html document and sendobject but the page just came through as text
with the html tags in it.  How do you automate sending of html formated
e-mail?  I'd like for the client to be able to see the message in Outlook
before it is sent so they can personalize it.

The test I did with using automation used the following code.  As I said the
formating of the text stayed as it should but the logo image that started
out at the top of the template ended up at the bottom of the e-mail.  Any
suggestions?

Private Sub cmdSend_Click()
Dim oOut As Outlook.Application
Dim Item As MailItem

   On Error GoTo cmdSend_Click_Error
    
    Set oOut = New Outlook.Application
    Set Item = oOut.CreateItemFromTemplate("C:\Documents and
Settings\Doug\Application Data\Microsoft\Templates\SampleVideo2.oft")
    With Item
        .To = "dw-murphy at cox.net"
        .Subject = "New Video"

        .Body = Replace(.Body, "<NAME>", Nz(Me.txtName, ""))
        .Body = Replace(.Body, "<DATE>", Date)
        .Body = Replace(.Body, "<ADDRESS>", Nz(Me.txtStreet, ""))
        .Body = Replace(.Body, "<CITY_STATE_ZIP>", Nz(Me.txtCSZ, ""))
        .Body = Replace(.Body, "<FIRSTNAME>", Nz(Me.txtFirst, ""))
        .Send
    End With

cmdSend_Click_Exit:
   On Error GoTo 0
    Set Item = Nothing
    Set oOut = Nothing
   Exit Sub

Doug




More information about the AccessD mailing list