Consulting

Results 1 to 2 of 2

Thread: Create custom toolbar

  1. #1

    Create custom toolbar

    I'd like to create a custom toolbar in outlook (which isn't difficult).
    However, I would like there to be a textbox on the toolbar as well (like outlook has for address book searches).

    Is this possible, and can my toolbar buttons interact with the textbox?
    My toolbar will require the user to enter a file number and then click a button. The macro tied to that button will be dependant on the text entered in the box.

    I found an addin for vs2008 that does just that but it costs 3-800$ per liscence to let you make controls using .net.


    *****EDIT


    I seem to have figured out how to add a combobox... it doesn't look like a text box is possible.

    [VBA]Private Sub Application_Startup()

    'Adds a custom button to the standard toolbar if it's not there already.
    'Clicking on this button calls a custom action that would have to be
    'defined in a separate sub, see the .OnAction line below.
    Dim cbb As CommandBarComboBox
    Dim cbStandard As CommandBar
    Dim cbExist As Boolean

    'The Standard toolbar is the one with "New", "Send/Receive", etc on it.
    Set cbStandard = ActiveExplorer.CommandBars("Standard")
    cbExist = IsMenuThere("Standard", "CustomButton")

    'If the option is not already on the menu, add it
    If cbExist = False Then
    Set cbb = cbStandard.Controls.Add(Type:=msoControlComboBox, Before:=1)

    cbb.Caption = "Custom&Button"
    cbb.OnAction = "NameOfFunctionToCallOnClick"
    cbb.TooltipText = "Tooltip for this button"
    End If

    Set cbb = Nothing
    Set cbEdit = Nothing
    Set cbStandard = Nothing

    End Sub

    Public Function IsMenuThere(sMenu As String, sName As String) As Boolean
    'Returns true if menu sName exists in sMenu
    Dim cbb As CommandBar
    Dim cbControl As CommandBarControl

    IsMenuThere = False

    Set cbb = ActiveExplorer.CommandBars(sMenu)

    'Cycles through the given commandbar, checking the captions to see
    'if they match the one we're looking for
    For Each cbControl In cbb.Controls
    If cbControl.Caption = sName Then
    IsMenuThere = True
    Exit Function
    End If
    Next

    Set cbb = Nothing
    Set cbControl = Nothing

    End Function



    [/VBA]
    Last edited by bigdan43; 08-25-2008 at 01:49 PM.

  2. #2
    This question is a continuation of the same project above.

    I have completed the interface and now I need to write code that will take the selected message(s) in outlook and save as .msg to the directory I will provide it. I'm just unsure how to count the selected outlook items and seperate them to be saved individually. Any help would be appreciated, I'm looking for some starter code thats all as I'm not familiar with outlook mapi functions.

Posting Permissions

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