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 =
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"
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
>
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
Originally Posted by 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
>
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
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks