Google Answers Logo
View Question
 
Q: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button ( No Answer,   7 Comments )
Question  
Subject: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
Category: Computers > Programming
Asked by: klausb-ga
List Price: $20.00
Posted: 09 Jan 2006 20:45 PST
Expires: 08 Feb 2006 20:45 PST
Question ID: 431385
I want to have a button that does a basic "reply-to-all" function on a
highlighted message - with some twists.
1. a dialog box should first promt me to enter two values (a name and a number)
2. the subject should be modified to: 
   "whatever_the_original_subject_was_with_RE:_prefix [BKT/" + 'num_val + "]"
3. the body should have: 
   Hello 'name_val',
   some other text that I can add to the vba myself BKT/" + 'num_val' 
   + chr(13) + chr(13) +
   "Regards,"  + chr(13) + OutlookUserName
4. it should NOT send the message automatically as some odd changes may be needed. 
5. Ideally I want to add this macro to a button on the tool bar

Clarification of Question by klausb-ga on 11 Jan 2006 13:24 PST
I even settle for an answer that does not include the dialog box for the two values.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
From: tabspro-ga on 13 Jan 2006 11:42 PST
 
I think I can help you with this as I am into extereme MS office
customization .. Do you want me to write you a code with the
explanations or send you a complete macro that you can directly use in
outlook and assign it to a cutom button ... In either way I can help
you ...
Subject: Re: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
From: klausb-ga on 13 Jan 2006 13:29 PST
 
tabspro, you rock! 
The complete macro would be super. 
I will be able to edit text in it right? I.e. open it in the Outlook
VBA editor and change the copy.
-klaus
Subject: Re: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
From: empire888-ga on 17 Jan 2006 09:13 PST
 
Guys,

I'm trying to add a custom setting to my outlook. I want my Outlook
2003 to ask for a password everytime i hit the "reply to all" button.
Can this be done?
So if i create an email i will set a password so that people need to
know the password to be able to reply to all. Hope this make sense!

And thanks for all your help!
Subject: Re: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
From: skidmark-ga on 18 Jan 2006 15:47 PST
 
I've written the macro and it works quite well. Cannot upload it here,
where do you want it?
Subject: Re: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
From: klausb-ga on 18 Jan 2006 15:58 PST
 
I don't know how uploading to Google answers works... You could send
it to my email address: klausb [at ] gmail [dot] com
Or you could post code and instructions here. 

Thanks!
Subject: Re: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
From: skidmark-ga on 19 Jan 2006 02:03 PST
 
The solutions comes in two parts. (It would be easier if Google
allowed upload, but perhaps it is a virus issue) Anyway, here is is i
plaintext. I hope you find it useful.

* The first is code that should be placed in a module in the VBA
editor (labeled [MODULE1.BAS] below)

* The second is a form, which you must create and place for controlls on:
form name "frmReplyAllEx"
  textbox "txtName",
  textbox "txtNumber",
  button "cmdCancel",
  button "cmdPreview"
(Place the code labeled [FRMREPLYALL.FRM] below in this form)

[MODULE1.BAS]
Option Explicit

Public Sub AddToToolBar()

Const NEW_BUTTON_CAPTION As String = "Reply to All Ex"
Const TOOLBAR_TO_USE As String = "Standard"

Dim oExplorer As Outlook.Explorer
Dim oCommandBars As CommandBars
Dim oCommandBar As CommandBar
Dim oButton As CommandBarControl
    
    On Error GoTo Err
    
    'Get the active explorer
    Set oExplorer = Outlook.Application.ActiveExplorer
    
    'Find the Standard toolbar
    Set oCommandBars = oExplorer.CommandBars
    Set oCommandBar = oCommandBars.Item(TOOLBAR_TO_USE)
    
    On Error Resume Next
    Set oButton = oCommandBar.Controls.Item(NEW_BUTTON_CAPTION)
    If oButton Is Nothing Then
        Set oButton = oCommandBar.Controls.Add(Type:=msoControlButton,
Temporary:=False)
    End If
    
    'Add a button
    With oButton
        .Caption = NEW_BUTTON_CAPTION
        .Enabled = True
        .HyperlinkType = msoCommandBarButtonHyperlinkOpen
        .TooltipText = "Modified reply to all function"
        .OnAction = "ReplyToAllEx"
    End With
    
    Exit Sub
    
Err:
    
    MsgBox Err.Description, vbCritical
    
End Sub

Public Sub ReplyToAllEx()

Dim oExplorer As Outlook.Explorer

Dim oSelectedMail As MailItem
Dim oNewMail As MailItem

Dim sName As String
Dim sNumber As String
    
    On Error GoTo Err
    
    Set oExplorer = Outlook.Application.ActiveExplorer
    
    'Check if something is selected
    If oExplorer.Selection.Count > 0 Then
        
        'Get the first item selected (currently only supports single selection)
        Set oSelectedMail = ActiveExplorer.Selection.Item(1)
        
        'Display the form
        Set frmReplyAllEx = New frmReplyAllEx
        frmReplyAllEx.Show
        
        'Get the input from the form
        sName = frmReplyAllEx.txtName
        sNumber = frmReplyAllEx.txtNumber
        
        'Check if a name was entered
        If sName <> "" Then
            
            'Create a Reply template
            Set oNewMail = oSelectedMail.ReplyAll
            
            With oNewMail
                
                'Change the subject
                .Subject = "RE: " & oSelectedMail.Subject & " [BKT/'"
& sNumber & "']"
                
                'Change the body
                .Body = "Hello '" & sName & "', " & " BKT/'" & sNumber & "'"
                .Body = .Body & Chr(13) & Chr(13)
                .Body = .Body & "Regards," & Chr(13)
                .Body = .Body & Outlook.Application.Session.CurrentUser.Name
                
                'Display the new mail before sending it
                .Display
            
            End With
            
        End If
        
    End If
    
    Exit Sub
    
Err:
    
    MsgBox Err.Description, vbCritical
    
End Sub

[FRMREPLYALL.FRM]

Option Explicit

Private Sub cmdCancel_Click()
    
    txtName.Text = ""
    txtNumber.Text = ""
    
    Unload Me

End Sub

Private Sub cmdPreview_Click()
    
    Me.Hide
    
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    
    txtName.Text = ""
    txtNumber.Text = ""
    
End Sub
Subject: Re: Outlook 2003 (Exchange) Reply-To-All VBA (Macro) button
From: klausb-ga on 20 Jan 2006 16:35 PST
 
I added the following to the BODY part: 

.Body = .Body & Chr(13) & Chr(13)
.Body = .Body & "<< --- ORIGINAL MESSAGE --- >>"
.Body = .Body & Chr(13) & Chr(13)
.Body = .Body & oSelectedMail.Body

But I much rather would have the full original message inserted as it
usually is on the "Reply" or "Reply To All" actions. But my hack works
for the time being.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy