Results 1 to 8 of 8
  1. #1
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66

    Add Signature to Outlook Email - (Signature in User File!) - IDEA Combine MEMO

    I am challenged like many in regards to adding a signature to an Outlook Email.

    Let me explain where I am.

    I have a form which allows someone to send an email: (4_qryEmailExpanded)

    Here is the code in that form:

    Code:
    Private Sub SecondEmail_Click()
    
    'open Outlook, attach zip folder or file, send e-mail
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
        .BodyFormat = olFormatRichText
        .To = ""
        ''.cc = ""
        ''.bcc = ""
        .Subject = Me.EmailSubjectField
        .HTMLBody = Me.EmailMessageField
        '.Attachments.Add ("path\filename")
        ''.DeleteAfterSubmit = True 'This would let Outlook send the note without storing it in your sent bin
        .Display
        '.Send
    End With
    End Sub
    As you can see, the HTMLBody comes from the field EmailMessageField (MEMO FIELD)

    I have a table which contains user information: (tbl.Security)
    This has an HTML field (EmailSignature) which has the users email signature (imagine that!) (MEMO FIELD)

    I also use
    Sully's security:
    (basUserInfo) which has this information:

    Code:
    Public Type UserInfo
    ' ViewID - Type of access (Text - Associted with AccessID #)
        ViewID As Integer
    ' AccessID - Type of access (Access # Associated with ViewID)
        AccessID As Integer
    ' Active - Is the user active
        Active As Boolean
    ' Password - The users password
        Password As String
    ' UserID - The User Name (Joe - Associated with SecurityID)
        UserID As String
    ' SecurityID - The User ID (4 - Associated with UserID)
        SecurityID As String
    End Type
    
    Public User As UserInfo
    My idea is to... COMBINE Me.EmailMessageField & tbl [tbl.Security].EmailSignature based on 'Active' (from 'basUserInfo') to create an email which has a signature!!!!

    THOUGHTS?????



    I found this:

    Code:
    SELECT Table1.*, Table2.*
    FROM Table1, Table2
    WHERE (Table1.MemoField=table2.MemoField);
    I don't know if something like that would work!?!?!?!?!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    If you know the user's ID then you can query the relative information and assign it to various string variables. Below is similar code to what I use as a sig line. As an example....


    Code:
    Dim strBody As String
    Dim strUser As String
    Dim strTitle As String
    Dim strPhone As String
    strBody = ""
    strUser = ""
    strTitle = ""
    strPhone = ""
        strBody = "Please find the attached quote number " & lngIndex & "." & vbCrLf
        strBody = strBody & "Review the quote and reply to this email, confirming your agreement with the rates." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf
        strBody = strBody & "Regards," & vbCrLf & vbCrLf
        strBody = strBody & strUser & vbCrLf
        strBody = strBody & strTitle & vbCrLf
        strBody = strBody & strPhone & vbCrLf & vbCrLf
        strBody = strBody & "Company Name, Corp" & vbCrLf
        strBody = strBody & "12345 Something St" & vbCrLf
        strBody = strBody & "MyCity, NY 12345" & vbCrLf
        strBody = strBody & "" & vbCrLf & vbCrLf & vbCrLf & vbCrLf

  3. #3
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66
    Unfortunately... that isn't helping me.
    I tried to combine to two but no luck.

    Thank's for trying.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe something like

    .HTMLBody = Me.EmailMessageField & strBody

  5. #5
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66
    This worked!!!

    Code:
    Private Sub SecondEmail_Click()
    
    'open Outlook, attach zip folder or file, send e-mail
    Dim appOutLook As OutLook.Application
    Dim MailOutLook As OutLook.MailItem, SaveSig As String
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    MailOutLook.Display
    SaveSig = MailOutLook.HTMLBody
    With MailOutLook
        .BodyFormat = olFormatRichText
        .To = ""
        ''.cc = ""
        ''.bcc = ""
        .Subject = Me.EmailSubjectField
        .HTMLBody = Me.EmailMessageField & SaveSig
        '.Attachments.Add ("path\filename")
        ''.DeleteAfterSubmit = True 'This would let Outlook send the note without storing it in your sent bin
        .Display
        '.Send
    End With
    End Sub

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Cool, so you grab the existing sigline from the new email message object? Nice work.

  7. #7
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66
    This was something that was giving me FITS for days on days!

    I wonder if this code should be be a sticky as I know there are a TON of people who are looking for a solution!

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I say post your code in a new thread in the "Code Repository" forum. You can give a description of what it does and add keywords so it is searchable. I can see instances where I could implement it.
    https://www.accessforums.net/code-repository/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. adding signature to the email sendobject
    By webisti in forum Access
    Replies: 3
    Last Post: 07-10-2012, 03:08 PM
  2. Digital signature
    By NISMOJim in forum Access
    Replies: 2
    Last Post: 02-14-2011, 07:59 PM
  3. Add Signature Box in a form
    By kowsigan in forum Forms
    Replies: 1
    Last Post: 12-20-2010, 03:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums