Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    The code works for me. Post your entire procedure, including the SendEMail Sub.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    dmcmillo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    13
    Private Sub Complete_Click()
    Dim OL As Outl ook.Application

    Dim MyItem As Outlook.MailItem

    Dim sHTML As String
    Dim sSubject As String

    Dim sTo As String
    Dim sCC As String
    Dim sBody As String

    'specifiy the references for the object library
    'This is the body of the email, the "<br><br><br> are breaks for the html
    'Original
    'sHTML = "<html><body> Collation Team," & "<br><br><br> " & "AutoRelease priorities have been changed to the below settings." & "<br><br><br> " & "Reason" & "<br><br><br> " & _
    "New Settings" & "<br><br><br> " & "" & " <br></body></html>"
    sHTML = "<html><body> Collation Team," & "<br><br><br> " & "AutoRelease priorities have been changed to the below settings." & "<br><br><br> " & "Reason:" & Me.Reason & " <br><br><br> " & _
    "New Settings:" & "<br><br><br> " & "<img src='C:\Users\dmcmillo\Pictures\2 alt='some text' style='width:145px;height:126px;'></body></html>" & " <br></body></html>"



    sSubject = "Collation AutoRelease Priority Change"
    'sTo = ""
    'sCC = ""
    'calls the function to email
    Call SendEMail(sTo, sCC, sSubject, sHTML)



    End Sub


    Public Function SendEMail(sTo, sCC, sSubject, sBody)

    Dim olapp As Object
    'Set olapp = CreateObject("outlook.application")
    Dim objMail As Object
    Dim olReceipent As Object

    On Error GoTo Err_Handler

    Set olapp = GetObject(, "outlook.application.14")
    If olapp Is Nothing Then
    GoTo Err_Handler
    End If

    Set objMail = olapp.CreateItem(0)
    With objMail
    .To = sTo
    .CC = sCC
    .Subject = sSubject
    .HTMLBody = sBody
    .Display
    .send
    End With
    Set olapp = Nothing
    Set objMail = Nothing

    Exit_Handler:
    Exit Function

    Err_Handler:
    Resume Exit_Handler

    End Function

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Not seeing a file name in the path and need closing apostrophe: 'C:\Users\dmcmillo\Pictures\2

    Should be like: 'C:\Users\dmcmillo\Pictures\2.jpg'

    Or whatever file name and extension your image has. The image name can be pulled from a textbox and concatenated into the HTML code same as the Reason text.

    You actually have more concatenation than necessary.

    sHTML = "<html><body>Collation Team,<br><br><br>AutoRelease priorities have been changed to the below settings.<br><br><br>Reason: " & Me.Reason & "<br><br><br>" & _
    "New Settings:<br><br><br><img src='C:\Users\dmcmillo\Pictures\" & Me.Image & "' alt='no image available' style='width:145px;height:126px;'></body></html><br></body></html>"
    Last edited by June7; 10-21-2015 at 05:46 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #19
    dmcmillo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    13
    Thanks for responding. I tried adding the full filepath as you stated. that didn't work. I go the same results as before.

  5. #20
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Again, post your exact modified code.

    Don't know what else to say. The code works for me. Here is mine:
    Code:
    Private Sub Email()
    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 = "Central Materials Laboratory Data"
        .HTMLBody = "<html><body>Collation Team,<br><br><br>AutoRelease priorities have been changed to the below settings.<br><br><br>Reason: Test<br><br><br>" & _
            "New Settings:<br><br><br><img src='C:\Users\June\DOT\Lab\Editing\LABDB.png' alt='some text' style='width:145px;height:126px;'></body></html>"
        .Display
    End With
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Bound Object Frame
    By bigguy in forum Forms
    Replies: 4
    Last Post: 04-15-2015, 03:14 PM
  2. Bound Object Frame Combo sorted Results
    By kevsim in forum Programming
    Replies: 7
    Last Post: 01-08-2011, 06:30 PM
  3. Replies: 2
    Last Post: 10-18-2010, 07:53 AM
  4. Replies: 1
    Last Post: 08-05-2010, 12:11 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