Allow users to change the email sent from Excel without changing the code



Allow users to change the email sent from Excel without changing the code. Check out my online courses www.easyexcelanswers.com/courses.html
All my courses include online support and a user manual
Let me teach you the VBA that I have learn in my five years of consulting

Let’s take the frustration out of user forms

Become an Affiliate and earn 25% on Course Sales

For more help visit my website www.easyexcelanswers.com or email me at easyexcelanswers@gmail.com.

Contact me regarding customizing this template for your needs.

Click for online Excel Consulting

I am able to provide online help on your computer at a reasonable rate.

I use a Blue condenser Microphone to record my videos, here is the link

Check out Crowdcast for creating your webinars

If you need to buy Office 2019 follow

I use Tube Buddy to help promote my videos
Check them out

Follow me on Facebook

TWEET THIS VIDEO

Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language

*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.

code
Sub donottouch()
Dim edress As String
Dim subj As String
Dim message As String
Dim filename As String
Dim outlookapp As Object
Dim outlookmailitem As Object
Dim myAttachments As Object
Dim path As String
Dim attachment As String
Dim x As Integer
Dim strbody As String
Dim Name, stuff1 As String
Dim stuff, stuff2 As String

x = 2

Do While Sheet1.Cells(x, 2) (does not equal symbol) “”
Set outlookapp = CreateObject(“Outlook.Application”)
Set outlookmailitem = outlookapp.createitem(0)
Set myAttachments = outlookmailitem.Attachments
path = “C:UsersscreaOneDriveDesktop”
subj = Sheet2.Cells(2, 3)
stuff = Sheet2.Cells(3, 3)
stuff1 = Sheet2.Cells(4, 3)
stuff2 = Sheet2.Cells(5, 3)
Name = Sheet1.Cells(x, 1)
edress = Sheet1.Cells(x, 2)
filename = “excellogo.jpg”
attachment = path + filename

strbody = “br Hello /br” & ” ” & Name _
& ” br h2 What is New this month? /h2 /br ” _
& ” BR /BR ” & stuff1 _
& ” br registar with code specialdeal: /br ” _
& ” ul ” _
& ” li Introduction to Excel /li ” & ” ” & stuff _
& ” i Introduction to VBA for Excel /li ” _
& ” li Mastering userforms in Excel/li” _
& “li Pivot Tables and Dashboards/li” _
& “li Excel Beyond the basics/li” _
& “/ul” _
& “br These courses include a number of lessons which have videos, downloadable files, notes for the videos and completed /br ” _
& “br /b” & stuff2 _
& “p” _
& “br Find me on YouTube at: a href=” & “””” & ” & “””” & ” My Channel /a /br ” _
& ” br ” _
& ” b Barb Henderson /br ” & _
” br Barb Henderson Consulting Limited /BR ” & _
” br 780 499 6658 /br ” _
& ” br or visit my website a href=” & “””” & ” & “””” & ” www.easyexcelanswers.com /a /br” _
& ” br mg src=’excellogo.jpg'” & “width=’131′ height=’124′”

subj = subj
With outlookmailitem
.To = edress
.cc = “”
.bcc = “”
.Subject = subj
.Attachments.Add path & filename, 0
.Body = “This mail-out was sent from Excel” & vbCrLf & “To be removed from this list, please respond to this email and state: Stop All”
.HTMLBody = strbody & “br” & .HTMLBody
.display
‘.send
End With
edress = “”
x = x + 1
Loop
Set outlookapp = Nothing
Set outlookmailitem = Nothing

End Sub

Watch more new videos about Excel Office | Synthesized by Mindovermetal English

Rate this post

Bài viết liên quan

Theo dõi
Thông báo của
guest
1 Comment
Cũ nhất
Mới nhất Được bỏ phiếu nhiều nhất
Phản hồi nội tuyến
Xem tất cả bình luận
Barb Henderson

The code for the email is written in HTML. I am unable to enter < or > in my description. All the commands in html should have <> around them. e.g. <br>