View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
K_Macd K_Macd is offline
external usenet poster
 
Posts: 54
Default right mouse click - cut copy paste in userform textboxes?

If you get off the ground with a rightclick menu the following clipboard
routines may be useful

Public Function TestClip() As Boolean

' Test for empty clipboard
Application.Volatile (True)

TestClip = IIf(Len(Trim(GetOffClipboard)) = 0, False, True)

End Function

Public Sub PutOnClipboard(Text As String)

Dim DataObj As New MSForms.DataObject ' REFERENCE SET IF INCLUDE DUMMY
USERFORM MODULE !
DataObj.SetText Text

DataObj.PutInClipboard
End Sub

Public Function GetOffClipboard() As String

' Extract text from clipboard
Application.Volatile (True)

Dim DataObj As New MSForms.DataObject
DataObj.GetFromClipboard

On Error GoTo ClipBError
GetOffClipboard = DataObj.GetText

Exit Function

ClipBError:
GetOffClipboard = ""

End Function

--
Ken
"Using Dbase dialects since 82"
"Started with Visicalc in the same year"


"Ryan H" wrote:

I have asked this question before in this forum and other forums, but with no
reply that I'm aware of. I have been using

Ctrl + C to Copy
Ctrl + V to Paste

There may be a way to put code into the Right Click Event that would
intialize a custom menu, but the trick would be accessing the clipboard. Not
sure if that is possible.
--
Cheers,
Ryan


"Roger on Excel" wrote:

Is there a way to enable the right mouse click in userforms to allow cut copy
paste in text/combo boxes?

The default setting seems to have this option disabled??
Thanks,
Roger