Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Dec 2006
    Posts
    250
    Thanks
    0
    Thanked 0 Times in 0 Posts

    email information (2003)

    Hello,

    I got the code below from Hans and would like to update it to have outlook send me a receipt emai, mark it as important and also to put in blue font and bold for the subject Information. I am also getting a "You did not send the email" message eventhough the emai was sent.


    Private sub cmdemailbutton_click()
    'This is a command button to send email to managers with invoice information

    On Error GoTo ErrorHandler_err

    Dim strmsg As String
    strmsg = "Dear " & Me![ManagerName] & "," & vbCrLf & vbCrLf & _
    "The Invoice Above is pending your approval."

    DoCmd.SendObject To:=Me![email], Subject:="Invoice" & " " & _
    Me![InvoiceStatusID] _
    & " " & "Amount $" & Me![InvoiceAmount], messagetext:=strmsg

    ErrorHandler_err
    MsgBox ("You did not send the email")

    Exit Sub


    End Sub

    Thanks in advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: email information (2003)

    SendObject cannot provide any kind of formatting in an e-mail.

    The lines in your code are not quite in the correct order: you must exit the procedure before the error handler, not after it, and there's a colon missing after the error handler label. It should be like this:
    <code>
    Private Sub cmdEmailButton_Click()
    'This is a command button to send email to managers with invoice information
    Dim strMsg As String
    On Error GoTo ErrorHandler_err

    strMsg = "Dear " & Me!<!t>[ManagerName]<!/t> & "," & vbCrLf & vbCrLf & _
    "The Invoice Above is pending your approval."
    DoCmd.SendObject To:=Me!<!t>[email]<!/t>, Subject:="Invoice " & _
    Me!<!t>[InvoiceStatusID]<!/t> & _
    " Amount $" & Me!<!t>[InvoiceAmount]<!/t>, MessageText:=strMsg
    Exit Sub

    ErrorHandler_err:
    MsgBox "You did not send the email"
    End Sub
    </code>
    If you want to send a copy of this e-mail to yourself, you can add a Cc argument:
    <code>
    DoCmd.SendObject To:=Me!<!t>[email]<!/t>, Cc:="me@somewhere.com", _
    Subject:="Invoice " & Me!<!t>[InvoiceStatusID]<!/t> & _
    " Amount $" & Me!<!t>[InvoiceAmount]<!/t>, MessageText:=strMsg
    </code>
    If you want to send another e-mail in the same procedure, you can add a second DoCmd.SendObject instruction.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2006
    Posts
    250
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: email information (2003)

    Thanks Hans for correcting the code. Is there another way I can change at least the font of the subject line to blue? I just want it to stand out when they receive the email.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: email information (2003)

    No, I don't know of any e-mail program that lets you format the subject of an e-mail.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •