Link to home
Start Free TrialLog in
Avatar of Tom Crowfoot
Tom CrowfootFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access to send Emails with Outlook signature block

Dear Experts

I'm using Access 2010 & Outlook 2010 & am keen to send emails from the Access Db I'm building, but want to the emails to be sent out to include the user's Outlook Signature Block.  

I'm keen not to create the signature block inside Access as a number of different users will use this Db, each of them has their own outlook signature block (which does contain images).

Can anyone help?
SOLUTION
Avatar of Jaroslav Mraz
Jaroslav Mraz
Flag of Slovakia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tom Crowfoot

ASKER

Thanks very much for all your help - managed to get this to work relatively easily - I also put in a simple browse feature at the start which took the user to the signature block folder so they could pick the relevant one (which took care of naming variations in their signature blocks)
Found a really easy way to include the standard signature block. Just display a blank message first, save it to a variable and then add it again before sending. It works with both standard and HTML emails. This code can be adapted to more complex email functions easily

Function SendEmail
    Dim OApp As Object, OMail As Object, signature As String
    Set OApp = CreateObject("Outlook.Application")
    Set OMail = OApp.CreateItem(0)
        With OMail
            .Display
        End With
    signature = OMail.body     'save standard signature block in text format OR
    signature = OMail.HTMLbody     'save standard signature block in HTML format

    With OMail
       .To = "someone@somedomain.com"
        .Subject = "Type your email subject here"
        .Attachments.Add
        .body = "Add body text here" & vbNewLine & signature      'add saved signature after your text in text format OR
        .body = "Add body text here" & "</br></br>" & signature      'add saved signature after your text in HTML format
        .Send
    End With
    Set OMail = Nothing
    Set OApp = Nothing
End Function