N
Newt
I am trying to create a macro with a toolbar button (that includes an up/down
toggle state) that allows me to select whether or not to have a read receipt
attached to my email. I figured out the readreceipt function, but am stumped
on setting the button state for the macro button. Here's my attempt. Any
ideas?
Sub AddReadReceiptRequest()
Dim objApp As Outlook.Application
Dim objInsp As Outlook.Inspector
Dim objItem As MailItem ' Object
Dim objExpl As Outlook.Explorer
Dim colCB As Office.CommandBars
Dim objCBB As Office.CommandBarButton
Set colCB = objExpl.CommandBars
Set objCBB = colCB.
' get the currently open item and make sure
' it's a mail message
Set objApp = CreateObject("Outlook.Application")
Set objInsp = objApp.ActiveInspector
If Not objInsp Is Nothing Then
Set objItem = objInsp.CurrentItem
If objItem.Class = olMail Then
' make sure it's unsent
If objItem.Sent = False Then
' push toggle button down
With objCBB
If .State = msoButtonUp Then
.Execute
End If
End With
' ask for read receipt
If objItem.ReadReceiptRequested = False Then
objItem.ReadReceiptRequested = True
End If
End If
End If
End If
Set objExpl = Nothing
Set colCB = Nothing
Set objCBB = Nothing
Set objApp = Nothing
Set objInsp = Nothing
Set objItem = Nothing
End Sub
toggle state) that allows me to select whether or not to have a read receipt
attached to my email. I figured out the readreceipt function, but am stumped
on setting the button state for the macro button. Here's my attempt. Any
ideas?
Sub AddReadReceiptRequest()
Dim objApp As Outlook.Application
Dim objInsp As Outlook.Inspector
Dim objItem As MailItem ' Object
Dim objExpl As Outlook.Explorer
Dim colCB As Office.CommandBars
Dim objCBB As Office.CommandBarButton
Set colCB = objExpl.CommandBars
Set objCBB = colCB.
' get the currently open item and make sure
' it's a mail message
Set objApp = CreateObject("Outlook.Application")
Set objInsp = objApp.ActiveInspector
If Not objInsp Is Nothing Then
Set objItem = objInsp.CurrentItem
If objItem.Class = olMail Then
' make sure it's unsent
If objItem.Sent = False Then
' push toggle button down
With objCBB
If .State = msoButtonUp Then
.Execute
End If
End With
' ask for read receipt
If objItem.ReadReceiptRequested = False Then
objItem.ReadReceiptRequested = True
End If
End If
End If
End If
Set objExpl = Nothing
Set colCB = Nothing
Set objCBB = Nothing
Set objApp = Nothing
Set objInsp = Nothing
Set objItem = Nothing
End Sub