Hi Alan,
Is it possible to have a shortcut menu woth cut/copy/paste etc appear when
you right-click on a textbox that is located on a useform?
Sure. Something like the following should get you started (all in the
userform code module):
Dim cbBar As CommandBar
Private Sub UserForm_Initialize()
Dim oButton As CommandBarButton
On Error Resume Next
Application.CommandBars("FormTextBoxBar").Delete
On Error GoTo 0
Set cbBar = Application.CommandBars.Add("FormTextBoxBar", msoBarPopup)
Set oButton = cbBar.Controls.Add(msoControlButton, , "Cut")
oButton.Caption = "Cut"
oButton.OnAction = "DoCut"
End Sub
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then cbBar.ShowPopup
End Sub
Private Sub UserForm_Terminate()
cbBar.Delete
End Sub
You'll then need to add a "DoCut" etc. routine in a standard module and work
out what to do with it. For example, you may want to have a global variable
that you can set in the MouseDown event to define which textbox you're
dealing with.
Regards
Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.ie