Creating a macro in Outlook 2002 to check a particular Send/Receive Group 
Author Message
 Creating a macro in Outlook 2002 to check a particular Send/Receive Group

Anyone have any ideas how to do this.  I've created a
Send/Recieve Group for checking my e-mail at home and
another one for checking my e-mail at work (obviously not
difficult to do).  Now I'd like to create macros to
activate these groups and put icons on the toolbar to run
the macros.  I know how to add macros to the toolbar
(again, not hard) but I don't know anything about writing
macros.  I'm used to recording them in Word (can't seem
to record in Outlook) and then intuitively editing them.  
Any help would be greatly appreciated.

--George



Wed, 29 Jun 2005 03:25:11 GMT  
 Creating a macro in Outlook 2002 to check a particular Send/Receive Group
Hey George.  I think this should work.  First, run this procedure to list in
the Immediate window the IDs for your account-specific menus after the "Send
and Receive All" menu item and before the "All Account" menu item:

Sub ListCommandBarControlIDs()
    Dim objCBs As CommandBars
    Dim objCBCs As CommandBarControls, objCBC As CommandBarControl
    Dim intX As Integer

    Set objCBs = Application.ActiveExplorer.CommandBars
    Set objCBC = objCBs.FindControl(, 31125) 'Retrieves menu items under the
Send/Receive menu
    Set objCBCs = objCBC.Controls

    For intX = 1 To objCBCs.Count
        Set objCBC = objCBCs.Item(intX)
        Debug.Print objCBC.Caption & " (" & objCBC.id & ")"
    Next
End Sub

Then create a macro procedure for every unique account, replacing [ID number
for account menu item] with the numbers obtained above.

Sub SendReceiveAccount1
    Dim objCBs As CommandBars
    Dim objCBC As CommandBarControl

    Set objCBs = Application.ActiveExplorer.CommandBars
    Set objCBC = objCBs.FindControl(, [ID number for account menu item])
    objCBC.Execute
End Sub

Then just create the toolbar buttons as usual, referencing the macro
procedure for the specific group you want to activate.

--
Eric Legault, MCSD
ADAPSYS - http://www.adapsys.ca


Quote:
> Anyone have any ideas how to do this.  I've created a
> Send/Recieve Group for checking my e-mail at home and
> another one for checking my e-mail at work (obviously not
> difficult to do).  Now I'd like to create macros to
> activate these groups and put icons on the toolbar to run
> the macros.  I know how to add macros to the toolbar
> (again, not hard) but I don't know anything about writing
> macros.  I'm used to recording them in Word (can't seem
> to record in Outlook) and then intuitively editing them.
> Any help would be greatly appreciated.

> --George



Wed, 29 Jun 2005 04:55:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Outlook 2002 VBA to Forward E-Mails Received w/out Saving to Sent Items

2. Outlook XP 2002 - Send and Receive

3. Outlook 2002 Macro Create button is disabled, why?

4. Automatically send email by Outlook 2002 from Project 2002

5. Outlook Send/Receive Group Failure

6. Send/Receive groups in Outlook XP

7. Outlook XP/2002 - Programmatically adding Sync Groups

8. Outlook XP/2002 - Setting Up Sync Groups

9. How to send and receive on a particular account using VBA

10. Outlook 2002/Macros/VB

11. Cannot use VBA macro's in Outlook 2002 (XP)

12. Cannot use VBA macro's in Outlook 2002 (XP)

 

 
Powered by phpBB® Forum Software