Sub OneButton()
Dim AddAry As Variant
Dim RngAdd As Variant
AddAry = Array("[COLOR=#ff0000]'pcode'!B2[/COLOR]", "[COLOR=#ff0000]'pcode'!H5[/COLOR]", "[COLOR=#ff0000]'pcode'!A11[/COLOR]", "[COLOR=#ff0000]'New'!A5[/COLOR]", "[COLOR=#ff0000]'New'!H7[/COLOR]", "[COLOR=#ff0000]'New'!B19[/COLOR]")
For Each RngAdd In AddAry
Call EmailProp(Range(RngAdd))
Next RngAdd
End Sub
Sub EmailProp(r As Range)
Dim oApp As Outlook.Application
Dim oNameSpace As Namespace
Dim oItem As AppointmentItem
LINK = Replace(ThisWorkbook.FullName, " ", "%20")
OffsetNum = Range(Cells(r.Row, r.Column), Cells(r.Row, r.Column)).Offset(-1, 1)
On Error Resume Next
' check if Outlook is running
Set oApp = GetObject("Outlook.Application")
If Err <> 0 Then
'if not running, start it
Set oApp = CreateObject("Outlook.Application")
End If
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oItem = oApp.CreateItem(olAppointmentItem)
With oItem
.Subject = Range(Cells(r.Row, r.Column), Cells(r.Row, r.Column)).Offset(OffsetNum, -5) + " - " + Worksheets("Template Generator").Range("H16") + " - " + Worksheets("Template Generator").Range("B16")
.Start = Range(Cells(r.Row, r.Column), Cells(r.Row, r.Column)).Offset(0, -2) + TimeValue("9:00")
.Body = "Click below to enter the link for this " & vbCrLf & vbCrLf & _
"file:///" + LINK
.Duration = "480"
.AllDayEvent = True
.Importance = olImportanceNormal
.Categories = "Red Category"
.BusyStatus = olFree
.Remindermin = "10080"
.ReminderOverrideDefault = True
.ReminderSet = True
.ReminderMinutesBeforeStart = "10080"
Select Case 1 ' do you want to display the entry first or save it immediately?
Case 1
.Display
Case 2
.Save
End Select
End With
Set oApp = Nothing
Set oNameSpace = Nothing
Set oItem = Nothing
End Sub