Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Apr 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem finding commandbar ids (Outlook 2003)

    I am trying to remove some menu options from Outlook 2003 using group policy. To do this I need to know the id numbers of the menu options. I found this article on the MS website:
    Managing Users' Configurations by Policy http://www.microsoft.com/office/ork/2003/f...ch18/MntA04.htm

    It had some sample code to allow you to find out the ids but it won't work in Outlook 2003 but will in Word 2002.

    The immediate code they gave was:
    ? commandbars("menu bar").controls("file").controls("save as...").id
    This gives an error saying sub or function not defined in outlook but works in word

    The macro code they gave was:
    Sub EnumerateControls()
    Dim icbc As Integer
    Dim cbcs As CommandBarControls
    Set cbcs = Application.CommandBars("Menu Bar").Controls("File").Controls
    For icbc = 1 To cbcs.Count
    MsgBox cbcs(icbc).Caption & " = " & cbcs(icbc).ID
    Next icbc
    End Sub
    This gives a runtime error 438 (object doesn't support property or method) in outlook but works in word.

    Can anyone help?

    Belinda

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: problem finding commandbar ids (Outlook 2003)

    Try Outlook Spy or my incomplete code <!post=here,386053>here<!/post>.
    -John ... I float in liquid gardens
    UTC -7▒DS

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: problem finding commandbar ids (Outlook 2003)

    In Outllook, there are two CommandBars collections, one for Explorers and one for Inspectors. Try:

    ? activeexplorer.commandbars("menu bar").controls("file").controls("save as...").id

    or

    ? activeinspector.commandbars("menu bar").controls("file").controls("save as...").id

    if you have a message or other inspector open.

  4. #4
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: problem finding commandbar ids (Outlook 2003)

    I get an error when I do this in the immediate window, or in code!

    ? application.ActiveInspector.CommandBars.Count

    I sometimes have used the following code to get info on commandbars

    Sub temp()
    Dim c As CommandBar
    Dim b As CommandBarControl

    'For Each c In Application.ActiveExplorer.CommandBars
    'Debug.Print "Explorer:"
    ' For Each b In c.Controls
    ' Debug.Print c.Name, b.Caption, 'print off any ID etc from controls([img]/forums/images/smilies/cool.gif[/img] and barę
    ' Next b
    'Next c

    End Sub
    Thanks,

    pmatz

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: problem finding commandbar ids (Outlook 2003)

    ActiveInspector is not valid if you only have the main Outlook window open; the main window is an Explorer object. You must have opened an Outlook item, such as a contact, an appointment or an e-mail. The window displaying the item is an Inspector object

    Note: if you use Word as your mail editor, no Inspector is associated with an open e-mail.

  6. #6
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: problem finding commandbar ids (Outlook 2003)

    Cool - of course, silly me <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15>
    Thanks,

    pmatz

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: problem finding commandbar ids (Outlook 2003)

    FWIW, I improved the code now attached <!post=here,386242>here<!/post>. Further improvements welcome.
    -John ... I float in liquid gardens
    UTC -7▒DS

  8. #8
    Lounger
    Join Date
    Apr 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: problem finding commandbar ids (Outlook 2003)

    I've just come back into work, its Monday morning over here in little old NZ, and found that all you wonderful people have been discussing my problem. I just tried out your code John and it works beautifully! Thank you all so much!!

    No doubt I will be posting again as we are in the middle of migrating from Groupwise to Exchange. I have some Word and Excel VB knowledge but am new to Outlook!

    Thanks again

    Belinda

Posting Permissions

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