+ Reply to Thread
Results 1 to 5 of 5

Tag in CommandBar

  1. #1
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256

    Tag in CommandBar

    Hi all,

    I have read help etc. but i'm still in the dark. Could someone explain to me the
    uses for "Tag" when dealing with Command Bars?
    IE:
    '.Tag =
    '.Caption =
    '.OnAction =
    '.Parameter =
    '.FaceId =
    '.Style =
    '.BeginGroup =
    '.TooltipText =
    Thx
    Dave
    "The game is afoot Watson"

  2. #2
    Ron de Bruin
    Guest

    Re: Tag in CommandBar

    Hi Desert

    Here is a example that add a control to the Cell menu
    (When you right click on a cell)

    Sub AddToCellDropDown()
    Dim CellDropDown As CommandBar
    Dim MyDropDownItem As CommandBarControl

    RemoveFromCellDropDown

    Set CellDropDown = Application.CommandBars("Cell")
    With CellDropDown.Controls.Add(Type:=msoControlButton, before:=1)
    .Caption = "Try me"
    .Style = msoButtonIconAndCaption
    .FaceId = 59
    .OnAction = ThisWorkbook.Name & "!Your_macro"
    .Tag = "MyDropDownItem"
    End With
    End Sub

    Sub RemoveFromCellDropDown()
    Dim MyDropDownItem As CommandBarControl
    Set MyDropDownItem = Application.CommandBars.FindControl(Tag:="MyDropDownItem")
    If Not MyDropDownItem Is Nothing Then
    MyDropDownItem.Delete
    End If
    Set MyDropDownItem = Nothing
    End Sub

    Sub Your_macro()
    MsgBox "Hi there."
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Desert Piranha" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi all,
    >
    > I have read help etc. but i'm still in the dark. Could someone explain
    > to me the
    > uses for "Tag" when dealing with Command Bars?
    > IE:
    > '.Tag =
    > '.Caption =
    > '.OnAction =
    > '.Parameter =
    > '.FaceId =
    > '.Style =
    > '.BeginGroup =
    > '.TooltipText =
    >
    >
    > --
    > Desert Piranha
    >
    >
    > ------------------------------------------------------------------------
    > Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
    > View this thread: http://www.excelforum.com/showthread...hreadid=569722
    >




  3. #3
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256
    Hi Ron,

    Thanks for your input here,

    So as i can see the "Tag" is just kinda like a Name for the command Bar. Right?

    So it is another way of doing this:

    'Delete Command Bar
    Application.CommandBars("cell").Controls("Try me").Delete
    or
    'Makes Command Bar temporary
    With .Controls.Add(Type:=msoControlButton, temporary:=True)

    And "Tag" will work with any kind of Command Bars?

    And would there be any other uses for "Tag" other than deleting the Command Bar?

    Thx
    Dave
    Quote Originally Posted by Ron de Bruin
    Hi Desert

    Here is a example that add a control to the Cell menu
    (When you right click on a cell)

    Sub AddToCellDropDown()
    Dim CellDropDown As CommandBar
    Dim MyDropDownItem As CommandBarControl

    RemoveFromCellDropDown

    Set CellDropDown = Application.CommandBars("Cell")
    With CellDropDown.Controls.Add(Type:=msoControlButton, before:=1)
    .Caption = "Try me"
    .Style = msoButtonIconAndCaption
    .FaceId = 59
    .OnAction = ThisWorkbook.Name & "!Your_macro"
    .Tag = "MyDropDownItem"
    End With
    End Sub

    Sub RemoveFromCellDropDown()
    Dim MyDropDownItem As CommandBarControl
    Set MyDropDownItem = Application.CommandBars.FindControl(Tag:="MyDropDownItem")
    If Not MyDropDownItem Is Nothing Then
    MyDropDownItem.Delete
    End If
    Set MyDropDownItem = Nothing
    End Sub

    Sub Your_macro()
    MsgBox "Hi there."
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Desert Piranha" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi all,
    >
    > I have read help etc. but i'm still in the dark. Could someone explain
    > to me the
    > uses for "Tag" when dealing with Command Bars?
    > IE:
    > '.Tag =
    > '.Caption =
    > '.OnAction =
    > '.Parameter =
    > '.FaceId =
    > '.Style =
    > '.BeginGroup =
    > '.TooltipText =
    >
    >
    > --
    > Desert Piranha
    >
    >
    > ------------------------------------------------------------------------
    > Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
    > View this thread: http://www.excelforum.com/showthread...hreadid=569722
    >

  4. #4
    Ron de Bruin
    Guest

    Re: Tag in CommandBar

    Hi

    I use it only for this but you can als use Enabled = False for example
    Look on the MSDN site for more info

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Desert Piranha" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi Ron,
    >
    > Thanks for your input here,
    >
    > So as i can see the "Tag" is just kinda like a Name for the command
    > Bar. Right?
    >
    > So it is another way of doing this:
    >
    > 'Delete Command Bar
    > Application.CommandBars("cell").Controls("Try me").Delete
    > or
    > 'Makes Command Bar temporary
    > With .Controls.Add(Type:=msoControlButton, temporary:=True)
    >
    > And "Tag" will work with any kind of Command Bars?
    >
    > And would there be any other uses for "Tag" other than deleting the
    > Command Bar?
    >
    > Thx
    > Dave
    > Ron de Bruin Wrote:
    >> Hi Desert
    >>
    >> Here is a example that add a control to the Cell menu
    >> (When you right click on a cell)
    >>
    >> Sub AddToCellDropDown()
    >> Dim CellDropDown As CommandBar
    >> Dim MyDropDownItem As CommandBarControl
    >>
    >> RemoveFromCellDropDown
    >>
    >> Set CellDropDown = Application.CommandBars("Cell")
    >> With CellDropDown.Controls.Add(Type:=msoControlButton, before:=1)
    >> .Caption = "Try me"
    >> .Style = msoButtonIconAndCaption
    >> .FaceId = 59
    >> .OnAction = ThisWorkbook.Name & "!Your_macro"
    >> .Tag = "MyDropDownItem"
    >> End With
    >> End Sub
    >>
    >> Sub RemoveFromCellDropDown()
    >> Dim MyDropDownItem As CommandBarControl
    >> Set MyDropDownItem =
    >> Application.CommandBars.FindControl(Tag:="MyDropDownItem")
    >> If Not MyDropDownItem Is Nothing Then
    >> MyDropDownItem.Delete
    >> End If
    >> Set MyDropDownItem = Nothing
    >> End Sub
    >>
    >> Sub Your_macro()
    >> MsgBox "Hi there."
    >> End Sub
    >>
    >>
    >> --
    >> Regards Ron de Bruin
    >> http://www.rondebruin.nl
    >>
    >>
    >>
    >> "Desert Piranha"
    >> <[email protected]> wrote in
    >> message
    >> news:[email protected]...
    >> >
    >> > Hi all,
    >> >
    >> > I have read help etc. but i'm still in the dark. Could someone

    >> explain
    >> > to me the
    >> > uses for "Tag" when dealing with Command Bars?
    >> > IE:
    >> > '.Tag =
    >> > '.Caption =
    >> > '.OnAction =
    >> > '.Parameter =
    >> > '.FaceId =
    >> > '.Style =
    >> > '.BeginGroup =
    >> > '.TooltipText =
    >> >
    >> >
    >> > --
    >> > Desert Piranha
    >> >
    >> >
    >> >

    >> ------------------------------------------------------------------------
    >> > Desert Piranha's Profile:

    >> http://www.excelforum.com/member.php...o&userid=28934
    >> > View this thread:

    >> http://www.excelforum.com/showthread...hreadid=569722
    >> >

    >
    >
    > --
    > Desert Piranha
    >
    >
    > ------------------------------------------------------------------------
    > Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
    > View this thread: http://www.excelforum.com/showthread...hreadid=569722
    >




  5. #5
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256
    Hi Ron,

    Thanks much, for the input. I think i got it figured out.

    Thx again
    Dave

    [Ron de Bruin]Hi

    I use it only for this but you can als use Enabled = False for example
    Look on the MSDN site for more info

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Desert Piranha" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi Ron,
    >
    > Thanks for your input here,
    >
    > So as i can see the "Tag" is just kinda like a Name for the command
    > Bar. Right?
    >
    > So it is another way of doing this:
    >
    > 'Delete Command Bar
    > Application.CommandBars("cell").Controls("Try me").Delete
    > or
    > 'Makes Command Bar temporary
    > With .Controls.Add(Type:=msoControlButton, temporary:=True)
    >
    > And "Tag" will work with any kind of Command Bars?
    >
    > And would there be any other uses for "Tag" other than deleting the
    > Command Bar?
    >
    > Thx
    > Dave
    > Ron de Bruin Wrote:
    >> Hi Desert
    >>
    >> Here is a example that add a control to the Cell menu
    >> (When you right click on a cell)
    >>
    >> Sub AddToCellDropDown()
    >> Dim CellDropDown As CommandBar
    >> Dim MyDropDownItem As CommandBarControl
    >>
    >> RemoveFromCellDropDown
    >>
    >> Set CellDropDown = Application.CommandBars("Cell")
    >> With CellDropDown.Controls.Add(Type:=msoControlButton, before:=1)
    >> .Caption = "Try me"
    >> .Style = msoButtonIconAndCaption
    >> .FaceId = 59
    >> .OnAction = ThisWorkbook.Name & "!Your_macro"
    >> .Tag = "MyDropDownItem"
    >> End With
    >> End Sub
    >>
    >> Sub RemoveFromCellDropDown()
    >> Dim MyDropDownItem As CommandBarControl
    >> Set MyDropDownItem =
    >> Application.CommandBars.FindControl(Tag:="MyDropDownItem")
    >> If Not MyDropDownItem Is Nothing Then
    >> MyDropDownItem.Delete
    >> End If
    >> Set MyDropDownItem = Nothing
    >> End Sub
    >>
    >> Sub Your_macro()
    >> MsgBox "Hi there."
    >> End Sub
    >>
    >>
    >> --
    >> Regards Ron de Bruin
    >> http://www.rondebruin.nl
    >>
    >>
    >>
    >> "Desert Piranha"
    >> <[email protected]> wrote in
    >> message
    >> news:[email protected]...
    >> >
    >> > Hi all,
    >> >
    >> > I have read help etc. but i'm still in the dark. Could someone

    >> explain
    >> > to me the
    >> > uses for "Tag" when dealing with Command Bars?
    >> > IE:
    >> > '.Tag =
    >> > '.Caption =
    >> > '.OnAction =
    >> > '.Parameter =
    >> > '.FaceId =
    >> > '.Style =
    >> > '.BeginGroup =
    >> > '.TooltipText =
    >> >
    >> >
    >> > --
    >> > Desert Piranha
    >> >
    >> >
    >> >

    >> ------------------------------------------------------------------------
    >> > Desert Piranha's Profile:

    >> http://www.excelforum.com/member.php...o&userid=28934
    >> > View this thread:

    >> http://www.excelforum.com/showthread...hreadid=569722
    >> >

    >
    >
    > --
    > Desert Piranha
    >
    >
    > ------------------------------------------------------------------------
    > Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
    > View this thread: http://www.excelforum.com/showthread...hreadid=569722
    >

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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