Public lstNo As Long
Public oContact As Outlook.ContactItem
Public Sub NewMessageUsingTemplate()
If TypeName(ActiveExplorer.Selection.Item(1)) = "ContactItem" Then
Set oContact = ActiveExplorer.Selection.Item(1) ' this works with the selected item, not opened
UserForm1.Show
Select Case lstNo
Case -1
From_Lou_Stoler 'macro name
Case 0
From_Lou_Stoler 'macro name
Case 1
Good_Morning_Catch_Up 'macro name
Case 2
Good_Afternoon_Catch_Up 'macro name
Case 3
Good_Morning_Catch_Up_to_Client 'macro name
Case 4
Good_Afternoon_Catch_Up_to_Client 'macro name
Case 5
Today_Meeting_Thank_You_Friend 'macro name
Case 6
Recent_Meeting_Thank_You_Friend 'macro name
End Select
End If
Set oContact = Nothing
End Sub
Private Sub From_Lou_Stoler()
Set oContact = GetCurrentItem()
Dim objMsg As MailItem
' Blank message
Set objMsg = Application.CreateItem(olMailItem)
' Use a template
'Set objMsg = Application.CreateItemFromTemplate("C:\Users\Stole r Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler.oft")
objMsg.To = oContact.Email1Address
'displays the message form so you can enter more text
objMsg.Display
'use this to send to outbox
'objMsg.Send
Set objMsg = Nothing
End Sub
Private Sub From_Lou_Stoler_and_Vcard()
Set oContact = GetCurrentItem()
Dim objMsg As MailItem
' Blank message
Set objMsg = Application.CreateItem(olMailItem)
' Use a template
'Set objMsg = Application.CreateItemFromTemplate("C:\Users\Stole r Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler.oft")
objMsg.To = oContact.Email1Address
'displays the message form so you can enter more text
objMsg.Display
'use this to send to outbox
'objMsg.Send
Set objMsg = Nothing
End Sub
Private Sub Good_Morning_Catch_Up()
Set oContact = GetCurrentItem()
Dim objMsg As MailItem
' Blank message
Set objMsg = Application.CreateItem(olMailItem)
' Use a template
'Set objMsg = Application.CreateItemFromTemplate("C:\Users\Stole r Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler.oft")
objMsg.To = oContact.Email1Address
'displays the message form so you can enter more text
objMsg.Display
'use this to send to outbox
'objMsg.Send
Set objMsg = Nothing
End Sub
Private Sub Good_Afternoon_Catch_Up()
Set oContact = GetCurrentItem()
Dim objMsg As MailItem
' Blank message
Set objMsg = Application.CreateItem(olMailItem)
' Use a template
'Set objMsg = Application.CreateItemFromTemplate("C:\Users\Stole r Law\AppData\Roaming\Microsoft\Templates\E-mail From Lou Stoler.oft")
objMsg.To = oContact.Email1Address
'displays the message form so you can enter more text
objMsg.Display
'use this to send to outbox
'objMsg.Send
Set objMsg = Nothing
End Sub
' repeat the private subs as needed
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function