-
Notifications
You must be signed in to change notification settings - Fork 0
/
Memo_Buttons.bas
53 lines (40 loc) · 1.77 KB
/
Memo_Buttons.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Attribute VB_Name = "Memo_Buttons"
Dim OldHTMLBody As String
Sub InsertMemo()
Dim oInspector As Inspector
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Dim CurrentAppointment As AppointmentItem, CurrentMail As MailItem
' Check if appointment item - create mail item first, if so
On Error Resume Next
Set CurrentAppointment = oInspector.CurrentItem
If Not CurrentAppointment Is Nothing Then
' It's an appointment
Set CurrentMail = Application.CreateItem(olMailItem)
Dim CalRcpnt As Recipient, MailRcpnt As Recipient
For Each CalRcpnt In CurrentAppointment.Recipients
Set MailRcpnt = CalRcpnt
If MailRcpnt.Type <> olBCC Then
If MailRcpnt.AddressEntry.GetExchangeUser Is Nothing Then
CurrentMail.Recipients.Add MailRcpnt.Name & " <" & MailRcpnt.Address & ">"
Else
CurrentMail.Recipients.Add MailRcpnt
End If
End If
Next CalRcpnt
CurrentMail.Recipients.ResolveAll
CurrentMail.Subject = CurrentAppointment.Subject
CurrentMail.Body = "-----Original Appointment-----" & vbCrLf & CurrentAppointment.Body
CurrentMail.Display
oInspector.Close (olPromptForSave)
End If
End If
Memo_UserForm.Show
End Sub
Public Sub CategoriesButton()
Dim Item As Outlook.MailItem
Set Item = Application.ActiveInspector.CurrentItem
Item.ShowCategoriesDialog
End Sub