Hello,
Is there anyway I can pass the option as a parameter. I'm currently doing this - the RespondType parameter is passed from another (public) Sub, the one which people will press from the ribbon.
Sub RespondWithDefaultAccount(ByVal RespondType As String)
On Error GoTo ErrorHandler
Dim Result As String
Dim Account As Outlook.Account
Select Case TypeName(Outlook.ActiveWindow)
Case "Explorer"
Select Case RespondType
Case "Reply"
Set Item = Outlook.ActiveExplorer.Selection.Item(1).Reply
Case "ReplyAll"
Set Item = Outlook.ActiveExplorer.Selection.Item(1).ReplyAll
Case "Forward"
Set Item = Outlook.ActiveExplorer.Selection.Item(1).Forward
End Select
Case "Inspector"
Select Case RespondType
Case "Reply"
Set Item = Outlook.ActiveInspector.CurrentItem.Reply
Case "ReplyAll"
Set Item = Outlook.ActiveInspector.CurrentItem.ReplyAll
Case "Forward"
Set Item = Outlook.ActiveInspector.CurrentItem.Forward
End Select
End Select
...
End Sub
So the RespondType case statement is repeated. Can I somehow do this:
Sub RespondWithDefaultAccount(ByVal RespondType As String)
On Error GoTo ErrorHandler
Dim Result As String
Dim Account As Outlook.Account
Select Case TypeName(Outlook.ActiveWindow)
Case "Explorer"
Set Item = Outlook.ActiveExplorer.Selection.Item(1).RespondType
Case "Inspector"
Set Item = Outlook.ActiveInspector.CurrentItem.RespondType
End Select
Thanks!