• Using OnAction in Outlook (Office 2003)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Using OnAction in Outlook (Office 2003)

    Author
    Topic
    #411013

    Can anyone help?

    I would like to override one of the icons (Reply to all) on the Outlook toolbar with a different Icon and Caption (which I am able to do). I am using the “OnAction” event and would like to run a message box then runs the Reply to all function. As I am very new at Outlook I am unsure how to run the “Reply to all” function. I have taken a look and have found “olActionCopyLike.olReplyAll” but am unable to do anything with it.

    Any help would be greatly appreciated.
    Jack

    Viewing 3 reply threads
    Author
    Replies
    • #888029

      (Edited by JohnBF on 13-Oct-04 10:58. Bad syntax! Bad!)

      Not sure exactly what you are trying to do, but see if calling this via OnAction gets you in the right direction:

      Sub jackreplytoall()
      Dim item As Object
      On Error Resume Next
      If TypeName(Application.ActiveWindow) = “Explorer” Then
      Set item = ActiveExplorer.Selection(1)
      Else
      Set item = ActiveInspector.CurrentItem
      End If
      On Error GoTo 0
      If Not item Is Nothing Then
      With item
      .ReplyAll
      .Save
      .Display
      End With
      Else
      MsgBox “Nothing selected”
      End If
      Set item = Nothing
      End Function

    • #888030

      (Edited by JohnBF on 13-Oct-04 10:58. Bad syntax! Bad!)

      Not sure exactly what you are trying to do, but see if calling this via OnAction gets you in the right direction:

      Sub jackreplytoall()
      Dim item As Object
      On Error Resume Next
      If TypeName(Application.ActiveWindow) = “Explorer” Then
      Set item = ActiveExplorer.Selection(1)
      Else
      Set item = ActiveInspector.CurrentItem
      End If
      On Error GoTo 0
      If Not item Is Nothing Then
      With item
      .ReplyAll
      .Save
      .Display
      End With
      Else
      MsgBox “Nothing selected”
      End If
      Set item = Nothing
      End Function

    • #888105

      Off the top of my head, I don’t know the ID associated with the Reply All button/menu item. Let’s pretend it’s 500. Let me also assume that your new button does not have the same ID. You should be able to “run” the missing button or menu item by executing the control with that ID:

      ActiveInspector.CommandBars.FindControl(Id:=500).Execute

      On the other hand, if your code works by intercepting this command ID, you’d have to invoke this feature another way.

      • #888137

        It’s 355. post 386242.

        I always forget the .Execute Method, but many of the dialogs in Outlook don’t return any information and so are a nuisance to use.

        • #888184

          Thanks for your help John. I’ll give it a try.

          Regards
          Jack

          • #888316

            I really think just lik in Word you need to capture the “event”.

            Have a look at event trapping:

            “with events” is the key search word

            Dim MyClass As New clsWordApp

            Sub AutoOpen()
            Dim wdSaveProtectionType As Integer

            On Error GoTo ErrorHandler

            Call Register_Event_Handler
            End Sub

            Sub Register_Event_Handler()
            Set MyClass.appWord = Word.Application
            End Sub

            Pete

          • #888317

            I really think just lik in Word you need to capture the “event”.

            Have a look at event trapping:

            “with events” is the key search word

            Dim MyClass As New clsWordApp

            Sub AutoOpen()
            Dim wdSaveProtectionType As Integer

            On Error GoTo ErrorHandler

            Call Register_Event_Handler
            End Sub

            Sub Register_Event_Handler()
            Set MyClass.appWord = Word.Application
            End Sub

            Pete

        • #888185

          Thanks for your help John. I’ll give it a try.

          Regards
          Jack

      • #888138

        It’s 355. post 386242.

        I always forget the .Execute Method, but many of the dialogs in Outlook don’t return any information and so are a nuisance to use.

    • #888106

      Off the top of my head, I don’t know the ID associated with the Reply All button/menu item. Let’s pretend it’s 500. Let me also assume that your new button does not have the same ID. You should be able to “run” the missing button or menu item by executing the control with that ID:

      ActiveInspector.CommandBars.FindControl(Id:=500).Execute

      On the other hand, if your code works by intercepting this command ID, you’d have to invoke this feature another way.

    Viewing 3 reply threads
    Reply To: Using OnAction in Outlook (Office 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: