Avatar of eshurak
eshurakFlag for United States of America

asked on 

Outlook 2007 - VB6 - reply to all ribbon button onclick event

I have an existing VB6 COM add-in that I would like to modify to work with Outlook 2007 without using VSTO.  Currently in XP I can intercept the onclick event when the user "clicks" the reply to all button when the user has an email message opened, but  in 2007 I cannot intercept when the user "clicks" the reply to all button on the ribbon. Can I intercept a ribbon click using VB6?

My goal is to ask the user if they "really want to relpy to all?" using Outlook 2007 and VB6.

Microsoft DevelopmentOutlookVisual Basic Classic

Avatar of undefined
Last Comment
Avatar of c0ldfyr3
Flag of Ireland image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of eshurak
Flag of United States of America image


Thanks the got me started.  I had to add a little to it.  In case some one wants it in the future I'm attaching my code.  This code is for the connect module of a VB6 Addin project.
Option Explicit
Dim OutApp As New Outlook.Application
Public WithEvents myItem As Outlook.MailItem
Public WithEvents EmailHandler As Outlook.Inspectors
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As _
AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
    On Error GoTo error_handler
    Set EmailHandler = OutApp.Inspectors
    Exit Sub
    MsgBox Err.Description
End Sub
Private Sub EmailHandler_NewInspector(ByVal Inspector As Outlook.Inspector)
On Error GoTo AddButton_Error
'checks if this is an email.
If Inspector.CurrentItem.Class <> olMail Or Inspector.CurrentItem.Sent = False Then
    Exit Sub
End If
Set myItem = Inspector.CurrentItem ' Application.ActiveInspector.CurrentItem
   On Error GoTo 0
   Exit Sub
    Select Case Err
        Case 13, 438
            Resume Next
        Case Else
            MsgBox Err & " " & Err.Description, vbCritical, "Rename Attachment"
    End Select
End Sub
Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
    Dim mymsg As String
    Dim myResult As Integer
    mymsg = "Do you really want to reply to all original recipients?"
    myResult = MsgBox(mymsg, vbYesNo, "Flame Protector")
    If myResult = vbNo Then
        Cancel = True
    End If
End Sub

Open in new window

Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo