Jump to content

Excel Macros Visual Basic Code


Recommended Posts

I have a spreadsheet for work that I have to use. We are expected to make some minor customizations for our individual facilities. I still can't figure out one thing in particular: how to put the text above the embedded spreadsheet in the Outlook email. 

I've copied the code below. Any input would be great. 


Sub CopyPasteEmail()

Dim mailApp, mail As Object, lrow&, mrow&
Dim olMailItem, wEditor As Variant
Set mailApp = CreateObject("Outlook.Application")
Set mail = mailApp.CreateItem(olMailItem)

mail.to = (deleted for confidentiality)
mail.cc = (deleted for confidentiality)
mail.Subject = "Data for" & " " & Date


mail.HTMLbody = "<p>Team,<br></br>Here is the list of metrics to be completed. These metrics must be completed prior to morning brief.</b><p> Please reach out to Safety if you have any questions.</p><h3>Who fills out the metrics?</h3><ul><li>Days 1-5 post event: Area Manager</li><li>Days 6-8 Post event: Ops Manager</li><li>Days 9-12 post event: Sr Ops Manager</li><li>Days 13-14 post event: GM/AGM</li>"

Set wEditor = mailApp.ActiveInspector.wordEditor
wEditor.Range(0, 0).Select

Sheets("Open Cases").Range("A1:K10").Copy

End Sub

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...