I created a program for myself and a few of my colleagues. One of the functions of my program runs a macro that grabs data from the Excel sheet and opens a populated email in Outlook.
In order to run this macro you need to add the Object Library "Microsoft Outlook 16.0 Object Library".
Is there any way to do this automatically, so that all of my colleagues can run this macro?
Here's the code for my email generator.
' -- Drafts an email in Outlook -- '
Public Sub emailDraft()
Dim objOutlook As Outlook.Application
Dim objMail As Outlook.MailItem
Dim masterWS As Worksheet
Dim masterWB As Workbook
Dim counter As Long
Set objOutlook = Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)
Set masterWB = Workbooks("Master.xlsm")
Set masterWS = masterWB.Worksheets("MASTER SHEET")
objMail.To = masterWS.Range("F6").Value
objMail.CC = "test@email.com"
objMail.Subject = masterWS.Range("F7").Value
objMail.Body = masterWS.Range("F8").Value
objMail.Display
End Sub