Place jpg in body of email

gaib

Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
I've added a line to this VBA code to add a jpg to the body of this email, but instead, it's added as an attachment. Can this be corrected?

Also, instead of having the contacts folder selected thru the PickFolder, can this be automatic where the VBA code selects the contacts container?

Code:
Public Sub SendDeferredBirthdayGreetings()

    Dim bday
    Dim objOL As Outlook.Application: Set objOL = Outlook.Application
    Dim objFolder As Outlook.MAPIFolder: Set objFolder = Session.PickFolder
    'Dim objFolder As Outlook.MAPIFolder: Set objFolder = objOL.ActiveExplorer.CurrentFolder
    Dim objItems As Outlook.Items: Set objItems = objFolder.Items
    Dim obj As Object
    Dim oContact As Object
    Dim TheYear As Long
   
    For Each obj In objItems
        If TypeName(obj) = "ContactItem" Then
       
        Set oContact = obj
        bday = DateSerial(Year(now), Month(oContact.Birthday), Day(oContact.Birthday))
       
            If Month(bday) = Month(Date) Then
               
                If oContact.Email1Address = "" Then GoTo nextrecord
                bday = bday + 0.25 ' sets it for 6 am the day of the birthday
               
                Dim objMsg As MailItem: Set objMsg = Application.CreateItem(olMailItem)
               
                objMsg.To = oContact.Email1Address
                objMsg.Subject = "Happy Birthday" & " (" & Format(bday, "mmmm dd, yyyy") & ")"
               
                objMsg.Attachments.Add "C:\Users\gailb\Desktop\Happy Birthday.jpg"
               
                objMsg.Body = "Dear " & oContact.FirstName & "," & vbCrLf & vbCrLf & _
                    "Dropping a not to wish you a Happy Birthday on your special day." & _
                    vbCrLf & vbCrLf & "Praying you have a great day today and the year ahead is full of an overflowing abundance of blessings." & _
                    vbCrLf & vbCrLf & "God Bless, Gail"
               
                objMsg.DeferredDeliveryTime = bday
                objMsg.Display
'                objMsg.Send
                Set objMsg = Nothing
               
            End If
        End If
nextrecord:
    Next
End Sub
 
Similar threads
Thread starter Title Forum Replies Date
J Search and In-Place Archiving Using Outlook 0
piusg 2013: Place custom view on the ribbon Using Outlook 3
anoble1 Can you create a rule once an email moves to the Vault Inbox to another place? Using Outlook 0
E CustomTaskPane in PLace of Reading Pane Outlook VBA and Custom Forms 3
E CustomTaskPane in PLace of Reading Pane Outlook VBA and Custom Forms 3
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5
P Select image in contact notes field and save as jpg Outlook VBA and Custom Forms 6
L Show all images for jpg attachments in reading pane for received emails? Using Outlook 3
K Outlook 2007 preview jpg files Using Outlook 5
H Printing Tiff/JPG attachment Outlook VBA and Custom Forms 3
J How do you disable address search box when typing @ in body of email? Using Outlook 0
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
M Autoforward just attachment OR just body. Outlook VBA and Custom Forms 0
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
J Implement Keywords based on body message Outlook VBA and Custom Forms 0
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
M White square in body of Outlook Messages (O2016 Version 2012 32bit Click To Run) Using Outlook 4
P Forwarding emails issue with special characters replacing text body Using Outlook 1
witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
Z Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
S Body text of Email from invite date/time Outlook VBA and Custom Forms 7
A How To Get Body of All Emails to view in Blue Using Outlook 1
A How to get body of all emails in outlook 2016 to view in blue color Using Outlook 1
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
B Programmatically force html send and insert clipboard contents into body Outlook VBA and Custom Forms 0
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8
L dynamic and static dates in Outlook contact "notes" ie. body Using Outlook 2
L Wierd Office 365 Contact unable to edit body of random contacts Using Outlook 5
P Insert link in email body to attached document in Outlook 365 Outlook VBA and Custom Forms 0
W Space in an Outlook appointment body Using Outlook 0
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1
B Automatically Forward Emails and Remove/Replace All or Part of Body Outlook VBA and Custom Forms 8
D Body text of email disappears when I scan an attachment from printer to email Using Outlook 1
E Copying the whole e-mail body into excel Outlook VBA and Custom Forms 0
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
E Copy e-mail body from outlook and insert into excel Outlook VBA and Custom Forms 3
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
C How to replace or delete first instance of sentence in mail body? Outlook VBA and Custom Forms 1
Sabastian Samuel HOW DO I FORWARD AN EMAIL WITH MACRO using an email that in the body of another email Outlook VBA and Custom Forms 3
D Keep Original html body when forwarding an email Outlook VBA and Custom Forms 7
K Update subject based on text in body Outlook VBA and Custom Forms 3
C Transfer Outlook TextBox Text Into Email Body Outlook VBA and Custom Forms 2
Y VBA Macro to highlight some Keyword in mail body? Outlook VBA and Custom Forms 3
A Forwarding email and replacing body Outlook VBA and Custom Forms 1
K ind specific Subject line from outlook and copy the content of the email body to exce Outlook VBA and Custom Forms 0
K How to find specific header and copy the mail body Using Outlook 0

Similar threads

Top