I
ivarsb
In the chapter 4 ("Microsoft excel object") of Microsoft Office 97/
Visual Basic Programmer's guide I got sample code of adding extra
function for the right click menu.
I have a problem with Onaction property, when I tried also include
parameters for sub. I need to run sub with "Target" ( the cell on
which I clicked with right button) as parameter but VBA doesn't allow
to do that.
Also I wanted to know why the sample code set Control.Tag (icbc.Tag)
as brccm. For what the Tag property is used. And should I allways use
"brccm" as Tag value.
I am working on XL2000
This is the code I use:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel
As Boolean)
For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "brccm" Then icbc.Delete
Next icbc
If Not Application.Intersect(Target.Cells(1, 1), Range("A:A")) Is
Nothing Then
With Application.CommandBars("cell").Controls _
.Add(Type:=msoControlButton, before:=1, Temporary:=True)
.Caption = "Jauns instruments"
.OnAction = "mkrInstr"
.Tag = "brccm"
End With
End If
Thank you,
Ivars
Visual Basic Programmer's guide I got sample code of adding extra
function for the right click menu.
I have a problem with Onaction property, when I tried also include
parameters for sub. I need to run sub with "Target" ( the cell on
which I clicked with right button) as parameter but VBA doesn't allow
to do that.
Also I wanted to know why the sample code set Control.Tag (icbc.Tag)
as brccm. For what the Tag property is used. And should I allways use
"brccm" as Tag value.
I am working on XL2000
This is the code I use:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel
As Boolean)
For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "brccm" Then icbc.Delete
Next icbc
If Not Application.Intersect(Target.Cells(1, 1), Range("A:A")) Is
Nothing Then
With Application.CommandBars("cell").Controls _
.Add(Type:=msoControlButton, before:=1, Temporary:=True)
.Caption = "Jauns instruments"
.OnAction = "mkrInstr"
.Tag = "brccm"
End With
End If
Thank you,
Ivars