outlook vba help

matskiuk

New Member
Joined
Jan 28, 2019
Messages
1
Not sure if this is the place but I see a lot of google searches with replies with help for outlook vba coding, with some answers that are not, I think, relevant to my needs, I have 0% to 0% of vba coding

So here goes

I have a set emails sent in the same format from my website, all have the same layout I receive as in

Firstname: joe
Sirname: blogs
Email: someone@somewhere.something

I have an outlook template with a body of text

Something like

Dear

Thanks for requesting more info, Etc etc etc



Now I need a one click button on the ribbon, to automatically do this
In the reply email box put the email from the body of the text (as above)

Just after the “Dear” part I need the firstname inserted in the same format as “Dear” (its bold and arial)


And then all I need to do is click send




If anyone can help please
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
.
Code:
Option Explicit


Sub Send_Email()


    Dim c As Range
    Dim strBody As String
    Dim OutLookApp As Object
    Dim OutLookMailItem As Object
    Dim i As Integer
    On Error Resume Next
    
    
    For Each c In Range("G2:G100")
    strBody = "Greetings : " & c.Offset(0, -6).Value & "<br></br><br></br>" _
                & c.Offset(0, -2).Value & "<br></br><br></br><br></br>" _
                & "Sincerely, " & "<br></br><br></br>" _
                & "Your Signature Here"
                
    
        If c.Value <> "" Then
            Set OutLookApp = CreateObject("Outlook.application")
            Set OutLookMailItem = OutLookApp.CreateItem(0)
            With OutLookMailItem
                    .To = c.Offset(0, -5).Value
                    .CC = c.Offset(0, -4).Value
                    .Subject = c.Offset(0, -3).Value
                    .HTMLBody = strBody   'c.Offset(0, -2).Value
                    .Attachments.Add c.Offset(0, -1).Value
                    .Display
                    '.Send
            End With
        End If
    Next c


End Sub


Sub clrSend()
    Range("G2:G100").Value = ""
End Sub

Download workbook : https://www.amazon.com/clouddrive/share/ak9ftWp1QOISYMHsOsqaKApSpJtyHxlV7JaG0rXQb1l
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,522
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top