Place jpg in body of email

Status
Not open for further replies.

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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Witzker Place cursor at opening, a user defined OL contact form Outlook VBA and Custom Forms 3
L However, before you place an order, you want to pick out whether or not you want the to Using Outlook 0
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
Owl Export Outlook PDF Attachment as JPG? Outlook VBA and Custom Forms 4
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
G Retaining Tabs in outlook body Using Outlook 2
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
G Get current open draft message body from VBA Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
D Delete selected text in outgoing email body Outlook VBA and Custom Forms 0
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
K Incorporate selection from combobox into body of email Outlook VBA and Custom Forms 0
C Populate form data into message body Outlook VBA and Custom Forms 1
J Outlook 365 Add keywords from Listbox to the message body where cursor is placed Outlook VBA and Custom Forms 0
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 6
T 1:1 Datatransfer from incoming mail body to customs form body Outlook VBA and Custom Forms 0
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
Beeto Replace a string in body Outlook VBA and Custom Forms 2
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
Z Copy specific email body text Outlook VBA and Custom Forms 0
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

Similar threads

Back
Top