+ Reply to Thread
Results 1 to 2 of 2

How to select a Tab on Outlook 2010 Ribbon using VBA?

Hybrid View

  1. #1
    Registered User
    Join Date
    02-17-2008
    Posts
    21

    How to select a Tab on Outlook 2010 Ribbon using VBA?

    Newbie Outlook 2010 VBA programmer, intermediate Excel 2010 VBA Programmer.

    I have programmed a rule calling a VBA macro that automatically forwards all email received to an offsite account. Sometimes the rule fails with an Outlook (not VBA) error message and the rule becomes inactive until I reactivate it (by selecting the rule, clicking through all the choices and finally hitting Apply) then all is fine again (until the next time it happens.) Best guess as to its malfunction has to do with certain external emails received.

    I would like to have a macro that runs at Outlook Start-up that does one thing - clicks the Rules Tab on the Home Ribbon, then selects Manage Rules & Alerts drop-down menu item, which would then open the Rules and Alerts page so that I could ensure that the rule is activated and working.

    Is this possible? I am not as familiar with the Object Model for Outlook as Excel and do not know even where to start.

    Thanks for your help.

  2. #2
    Forum Contributor
    Join Date
    08-27-2006
    Posts
    136

    Re: How to select a Tab on Outlook 2010 Ribbon using VBA?

    I do not think your goal can be accomplished the way you state.

    You will want https://msdn.microsoft.com/en-us/lib...ffice.14).aspx to run this code at startup.

    Private Sub Enable_Rule()
       
        Dim olRules As Rules
        Dim olRule As Rule
        Dim rulename As String
        
        rulename = "Name of rule here"
        
        Set olRules = Application.Session.DefaultStore.GetRules
        Set olRule = olRules.Item(rulename)
        
        olRule.Enabled = True
        olRules.Save
        
        Set olRules = Nothing
        Set olRule = Nothing
        
        MsgBox rulename & " - should be enabled."
        
    End Sub
    To mark "Solved" go to Thread Tools.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [XL - 2010] run macro(add-in) from ribbon built from XML
    By jeremx in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2013, 12:14 PM
  2. Customizing the ribbon in 2010(vs 2007)
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2013, 03:29 AM
  3. [SOLVED] Customizing Ribbon in Word 2010
    By kapucino in forum Word Formatting & General
    Replies: 4
    Last Post: 05-15-2012, 07:54 AM
  4. Calling a Macro from Outlook Ribbon
    By sonny.thind in forum Outlook Programming / VBA / Macros
    Replies: 4
    Last Post: 03-21-2012, 08:00 AM
  5. Ribbon in Excel 2010
    By lalit.purohit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2012, 11:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1