Link to home
Start Free TrialLog in
Avatar of Ryan Simmons
Ryan Simmons

asked on

VBA: Creating a acknowledge button in Outlook to ease responding to a report

I use the following vba code in Excel to copy/paste a report from Excel to an email. Is it possible to setup something in the outlook email that would let me know whether or not the person read the report.

The best solution I can think of is to have a button in the email that says, "I have read and acknowledge this report." When the person clicks the button it would send me a email acknowledging that the report had been read.

Is it possible to set up something like the above in VBA code?

'The code below requires Microsoft Outlook Reference
'You can find references under tools in the vba client
Sub SendEmail()
'vars
Dim oApp As Outlook.Application
Dim oMail As MailItem
Dim wrdEdit
ActiveWorkbook.Save
'get running Outlook Application
Set oApp = GetObject(, "Outlook.Application")
'create a new email
Set oMail = oApp.CreateItem(olMailItem)
'set the subject and recipient
oMail.Subject = "Agent Daily Touchpoint"
oMail.To = "ryan.simmons@murphyusa.com"
oMail.CC = ""
'oMail.Attachments.Add ActiveWorkbook.FullName
'show it
oMail.Display
'change to HTML
oMail.BodyFormat = olFormatHTML
'get the word editor
 Set wrdEdit = oApp.ActiveInspector.WordEditor


'Copy code goes here (send keys)
Range("A1:K26").CopyPicture xlScreen, xlBitmap

'paste it into the email
wrdEdit.Application.Selection.Paste

'release objects
Set wrdEdit = Nothing
Set oMail = Nothing
Set oApp = Nothing
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ryan Simmons
Ryan Simmons

ASKER

What about the voting tool? Can that be put in via code?
I found the option on another site:

Sub Mail_Item_with_Voting_Buttons()
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olMailItem)
    myItem.VotingOptions = "Yes;No"
    myItem.Display

End Sub

Open in new window


https://www.tek-tips.com/viewthread.cfm?qid=1150903
Thanks I will take it from here.
Great!

Thanks for the feedback.