Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
I am created text boxes using views--Toolbars----control toolbox in excel. I need VBA code for right mouse button to copy, paste,delete and select all options. Could some one help me above situation. Thanks, Ram *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ram
Add this code into the code module for the worksheet that contains the textbox. To do this, right-click the tab of the worksheet with the textbox and choose "View Code" and then paste the code into the module. Change the name of the textbox to match yours: Private Sub TextBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = vbKeyRButton Then Call MakeMenu Application.CommandBars("TextBox Bar").ShowPopup End If End Sub Sub MakeMenu() Dim cbTextBox As CommandBar Dim cmdTest As CommandBarButton 'in case it already exists Call DeleteBar Set cbTextBox = CommandBars.Add(Name:="TextBox Bar", Position:=msoBarPopup, temporary:=True) With cbTextBox Set cmdTest = .Controls.Add(Type:=msoControlButton, temporary:=True) With cmdTest .Style = msoButtonIconAndCaption .FaceId = 3 .Caption = "test" .OnAction = "TestRoutine" End With End With End Sub Sub DeleteBar() 'in case it doesn't exist On Error Resume Next CommandBars("TextBox Bar").Delete End Sub Then in a regular module, add this code. This is the subroutine that's named in the OnAction property of the button. This is just an example: Public Sub TestRoutine() MsgBox "Test Pressed!" End Sub hth, Doug "ram gopal" wrote in message ... Hello All, I am created text boxes using views--Toolbars----control toolbox in excel. I need VBA code for right mouse button to copy, paste,delete and select all options. Could some one help me above situation. Thanks, Ram *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding commands to the Excel 2007 Chart context menu | Charts and Charting in Excel | |||
Undo button in the context menu (right click menu) | Excel Programming | |||
Custom Context menu (Right click menu) not working in sheet changeevent. | Excel Programming | |||
Adding context menu to shapes in Excel 2007 | Excel Programming | |||
Right-Click (Context Menu) | Excel Programming |