When I reply to a meeting invite sent to one of my non-default email accounts, Outlook sends the replies from the default account instead of the account the invite was sent to.
I tried using the ItemLoad
event to trap this situation and set a MailItem
object to use in a MailItem.Reply
event. I get a type error message in this line of code below Set NonDefaultMailboxMtgMsg = myObj
.
How can I set NonDefaultMailboxMtgMsg
to the meeting request's corresponding MailItem
object so it will trigger the reply event?
Public WithEvents NonDefaultMailboxMtgMsg As MailItem
Dim MeetingReplyDisplayName As String
Private Sub Application_ItemLoad(ByVal Item As Object)
Dim myObj As Variant
Set myObj = GetCurrentItem()
If myObj.Class = olMeetingRequest And myObj.Parent.Store.DisplayName _
<> Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Store.DisplayName Then
Set NonDefaultMailboxMtgMsg = myObj
MeetingReplyDisplayName = myObj.Parent.Store.DisplayName
End If
End Sub
Private Sub NonDefaultMailboxMtgMsg_Reply(ByVal Response As Object, Cancel As Boolean)
Response.SendUsingAccount = MeetingReplyDisplayName
End Sub
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
MeetingItem
, shouldn't you useMeetingItem_Reply
event instead ofMailItem
?Set NonDefaultMailboxMtgMsg = myObj
fails asmyObj
is checked for beingolMeetingRequest
what is aMeetingItem
not aMailItem
! – ComputerVersteherNonDefaultMailboxMtgMsg
asMeetingItem
, but thenPrivate Sub NonDefaultMailboxMtgMsg_Reply(ByVal Response As Object, Cancel As Boolean)
was never triggered. Wouldn't the above definition make this aMeetingItem_Reply
event? – JeffThisOutlookSession
stackoverflow.com/questions/24029515/… – ComputerVersteherThisOutlookSession
, but did not set upOutlook.Inspectors
to capture the reply event. I will try that. – Jeff