How can I add an Outlook signature line to an EmailDatabaseObject macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Daryl Austin
    New Member
    • May 2011
    • 24

    #1

    How can I add an Outlook signature line to an EmailDatabaseObject macro

    I have successfully added an "Email" button to a form for contacts in an access table. It uses the OnClick Event property to call an embedded macro called "EmailDatabaseO bject" which creates a blank email message to the selected contact. How can I automatically have my custom Outlook Signature appear in the message text of the email? Can anyone give me some guidance on how best to do this? Thanks.

    Code:
    Private Sub CmdEmail_Click()
    On Error GoTo CmdEmail_Click_Err
    Dim DAustinName As String
        DAustinName = "Daryl Austin"
            .Font.Bold = True
        '********
        ' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
        ' <UserInterfaceMacro For="delrec" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices/2009/11/forms"><Sta
        ' _AXL:tements><Action Name="OnError"/><Action Name="GoToControl"><Argument Name="ControlName">=[Screen].[PreviousControl].[Name]</Argument></Action><Action Name="ClearMacroError"/><ConditionalBlock><If><Condition>Not [Form].[NewRecord]</Condition><Statem
        ' _AXL:ents><Action Name="DeleteRecord"/></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[NewRecord] And Not [Form].[Dirty]</Condition><Statements><Action Name="Beep"/></Statements></If></ConditionalBlock><ConditionalBlock><If
        ' _AXL:><Condition>[Form].[NewRecord] And [Form].[Dirty]</Condition><Statements><Action Name="UndoRecord"/></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[MacroError]&lt;&gt;0</Condition><Statements><Action Name="MessageBox"><Argume
        ' _AXL:nt Name="Message">=[MacroError].[Description]</Argument></Action></Statements></If></ConditionalBlock></Statements></UserInterfaceMacro>
        Call DoCmd.SendObject(ObjectName:="", OutputFormat:="", _
                              To:=[E-mail], Cc: "", Bcc:="", _
                              Subject:=DAustinName & Chr(10) & _
                                       "Sr. Sales Manager" & Chr(10) & _
                                       "" & Chr(10) & _
                                       "BetterBuilt" & Chr(10) & _
                                       "Division of Northwestern Systems Corp" & Chr(10) & _
                                       "Tel. nnn-nnn-nnnn" & Chr(10) & _
                                       "Fax nnn-nnn-nnnn" & Chr(10) & _
                                       "Cell nnn-nnn-nnnn" & Chr(10) & _
                                       "Eml. xxxxxxx@xxxxxxxxxxxxxxx.com", _
                              EditMessage:=True, _
                              TemplateFile:="")
    
    
    CmdEmail_Click_Exit:
        Exit Sub
    
    CmdEmail_Click_Err:
        MsgBox Error$
        Resume CmdEmail_Click_Exit
    
    End Sub
    Last edited by NeoPa; Feb 9 '12, 06:06 PM. Reason: added sample code - NeoPa - Removed contact info
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    Daryl,

    I suggest you include the code you already have. Not only might it help put your problem into perspective, but it will help someone trying to look into it for you by ensuring they don't have to start from scratch. It's just common sense, but it may make it more likely that someone can/will help you.

    Comment

    • Daryl Austin
      New Member
      • May 2011
      • 24

      #3
      NeoPa

      Thanks. I figured out that I could convert the access macro into VBA code for the form (which I have above). I also figured out how to use the DoCmd.SendObjec t in Access and was able to add my email/phone etc to the message body. Now I'm struggling on to do simple stuff like "bold" my name. I created a string variable for my name and attempted to make it bold but I'm doing something wrong as it doesn't work. Can you give me any guidance on how to do that? Thanks.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Daryl, First let me say congrats for having the nouse to update the original post when adding your code. I was expecting to have to do that for you but I didn't have to. I did to obscure your personal contact details, which we don't allow on the site, principally for member protection, but also to avoid being targetted by scraper bots.

        As you did that though, I took the liberty of changing the code for you, so that it was visible to most readers without having to scroll the window to see that particular command at least.

        While I'm here though, let me explain a couple of things that may help you with your coding.
        1. Procedures and methods can be called with parameters identified by their positions, or by name. When calling anything with a large number of parameters, or with any missing parameters, the latter version is always a good idea.
        2. Parameters that you don't wish to specify can generally be left out completely (especially if you pass them by name). Passing an empty string ("") is not the same as passing no value. I suggest most of the "" parameters you passed should really be left unpassed.

        Comment

        Working...