Sending Outlook email w/ alt sig block

Discussion in 'Access VBA Modules' started by Doug Sanders, Nov 20, 2012.

  1. Doug Sanders

    Doug Sanders Guest

    Hi;

    I have inherited a tesk.
    Any of three different workers can enter data for a job into Access and it
    vreates an email response to go back to the prospect customer.

    It works. The problem is that the email then bears the 'From' field as any
    of these different workers.

    They would like there to be a generic signature block that could be appended
    instead of their usual one.

    Here is some of the code below:
    ---------------------------------------------------

    Dim CC_email As String
    Dim BCC_email As String
    Dim Subject_email As String
    Dim Body_email As String

    Dim lngClientContactID As Long
    Dim strClientEmailAddress As String
    Dim strAcknowledgementPdfPath As String

    On Error GoTo Err_SendAckMessage

    If Not IsNull(Forms!frmCase.Form.cboContactID_Client.Column(0)) Then
    lngClientContactID =
    Forms!frmCase.Form.cboContactID_Client.Column(0)
    strClientEmailAddress = Nz(DLookup("emailAddress", "tblContact",
    "contactID = " & lngClientContactID), "")
    Else
    MsgBox "No client contact has been chosen."
    End If

    strAcknowledgementPdfPath = DLookup("caseFolderLocation",
    "tsysReference")

    If Right(strAcknowledgementPdfPath, 1) <> "\" Then
    strAcknowledgementPdfPath = strAcknowledgementPdfPath & "\" &
    strQuoteNbr & "\" & strQuoteNbr & "_Acknowledgement.pdf"
    Else
    strAcknowledgementPdfPath = strAcknowledgementPdfPath & strQuoteNbr
    & "\" & strQuoteNbr & "_Acknowledgement.pdf"
    End If

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("tsysReference")
    ' Populate Recordset object.

    rst.MoveLast
    rst.MoveFirst

    On Error Resume Next

    With rst
    CC_email = !AckccEmailAddress
    BCC_email = !AckbccEmailAddress
    Subject_email = !AckEmailSubject
    Body_email = !AckEmailBody
    End With

    rst.Close
    On Error GoTo 0
    Set dbs = Nothing

    On Error GoTo 0
    ' Create the Outlook session.
    Set objOutlook = CreateObject("Outlook.Application")

    ' Create the message.
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

    With objOutlookMsg
    If strClientEmailAddress <> "" Then
    Set objOutlookRecip = .Recipients.Add(strClientEmailAddress)
    objOutlookRecip.Type = olTo
    End If

    ' Add the CC recipient(s) to the message.
    If CC_email = "" Then GoTo DoBcc
    Set objOutlookRecip = .Recipients.Add(CC_email)
    objOutlookRecip.Type = olCC

    DoBcc:
    If BCC_email = "" Then GoTo DoSubject

    ' Add the BCC recipient(s) to the message.
    Set objOutlookRecip = .Recipients.Add(BCC_email)
    objOutlookRecip.Type = olBCC

    DoSubject:
    ' Set the Subject, Body, and Importance of the message.
    .Subject = Subject_email
    .Body = Body_email
    .Importance = olImportanceHigh 'High importance

    ' Add attachments to the message.
    'Attachments based on EntryType Public variable
    js = EntryType

    If Not IsMissing(AttachmentPath1) Then
    Set objOutlookAttach = .Attachments.Add(AttachmentPath1)
    Else
    Set objOutlookAttach =
    ..Attachments.Add(strAcknowledgementPdfPath)
    End If

    If Not IsMissing(AttachmentPath2) Then
    Set objOutlookAttach = .Attachments.Add(AttachmentPath2)
    End If

    If Not IsMissing(AttachmentPath3) Then
    Set objOutlookAttach = .Attachments.Add(AttachmentPath3)
    End If


    ------------------------------------

    How can I call for a different email account in Outlook to send this email
    rather than the workers default accout.

    I know Outlook allows multiple accounts and you can manually select which
    one to use as a 'Send From'; I just want to automate this.

    Thanks, and if I'm in the wrong group, please point me in the right
    direction.

    DougSix
     
    Doug Sanders, Nov 20, 2012
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Victor Cheung

    my exe program doesn't show up.. when I use ALT-TAB?

    Victor Cheung, Dec 12, 2003, in forum: Access VBA Modules
    Replies:
    0
    Views:
    63
    Victor Cheung
    Dec 12, 2003
  2. Gary Schuldt

    How to Alt-Tab via code to another running App?

    Gary Schuldt, Sep 10, 2005, in forum: Access VBA Modules
    Replies:
    6
    Views:
    124
    Dirk Goldgar
    Sep 12, 2005
  3. ragtopcaddy via AccessMonster.com

    Can't Alt+tab to open forms or VB Editor

    ragtopcaddy via AccessMonster.com, May 8, 2006, in forum: Access VBA Modules
    Replies:
    0
    Views:
    66
    ragtopcaddy via AccessMonster.com
    May 8, 2006
  4. default105

    Disable alt+p in reports

    default105, Jun 11, 2006, in forum: Access VBA Modules
    Replies:
    1
    Views:
    73
    default105
    Jun 11, 2006
  5. cherman

    Simulate Alt+Enter in a table

    cherman, Nov 16, 2006, in forum: Access VBA Modules
    Replies:
    6
    Views:
    165
    cherman
    Nov 17, 2006
  6. Scott61

    Trap Alt + P during Print Perview

    Scott61, Apr 29, 2008, in forum: Access VBA Modules
    Replies:
    1
    Views:
    102
    Tom van Stiphout
    Apr 29, 2008
  7. jutlaux

    Alt Designator For AutoKeys

    jutlaux, Nov 13, 2008, in forum: Access VBA Modules
    Replies:
    1
    Views:
    157
    Stuart McCall
    Nov 13, 2008
  8. Humphrey

    Alt-F11 crashes database

    Humphrey, Jul 16, 2009, in forum: Access VBA Modules
    Replies:
    11
    Views:
    213
    David W. Fenton
    Jul 20, 2009
Loading...