Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default txtbox no right click copy menu available?


I need to highlight the contents of a textbox and copy it to th
clipboard. Momentarily it will be pasted into another application a
the file name to save that applications file as.

I can drag the mouse and highlight the .Text. I can then Ctrl-c t
copy the text to the clipboard. Then I can Ctrl-V or left click th
mouse and paste the .Text and save the file.

I would like to right click the mouse and have it select and copy th
txtbox.Text to the clipboard automatically.

I must be missing something simple.

Thanks for your suggestions,

Craig

--
Craig
-----------------------------------------------------------------------
Craigm's Profile: http://www.excelforum.com/member.php...fo&userid=2438
View this thread: http://www.excelforum.com/showthread.php?threadid=52529

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default txtbox no right click copy menu available?


http://www.cpearson.com/excel/clipboar.htm

I used his solution to make this work flawlessly.
------------------------------
Copying To The Clipboard

To access the Windows Clipboard from VBA, you must go through an
intermediate object of the DataObject type. If your VBA procedure will
be working with the clipboard, declare a NEW DataObject object with the
following statement.

Dim MyDataObj As New DataObject

The SetText method of the DataObject variable is used to store a text
string or numeric value in the variable For example:

MyDataObj.SetText "This Is A Text String" Or
MyDataObj.SetText 123.456

This sets the contents of MyDataObj to a value. To copy the contents
of the variable MyDataObj to the Windows clipboard, use the
PutInClipboard method .

MyDataObj.PutInClipboard


------------

Public Sub PutOnClipboard(Obj As Variant)
Dim MyDataObj As New DataObject
MyDataObj.SetText Format(Obj)
MyDataObj.PutInClipboard
End Sub


Public Function GetOffClipboard() As Variant
Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
GetOffClipboard = MyDataObj.GetText()
End Function


Public Sub ClearClipboard()
Dim MyDataObj As New DataObject
MyDataObj.SetText ""
MyDataObj.PutInClipboard
End Sub

----------------------------

Elegant solution


--
Craigm
------------------------------------------------------------------------
Craigm's Profile: http://www.excelforum.com/member.php...o&userid=24381
View this thread: http://www.excelforum.com/showthread...hreadid=525298

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Right click menu Mats.Bergstrand Excel Programming 0 December 17th 05 10:33 AM
right click menu PT SPORT CONTRUCTION CO.,LTD Excel Programming 2 October 13th 04 11:18 AM
Adding a menu item right click menu when clicking on a single. Andoni[_28_] Excel Programming 0 September 2nd 04 10:23 PM
right-click shortcut menu mark Excel Programming 9 August 22nd 04 02:40 AM
Adding menu to the mouse right click pop-up menu Jack Excel Programming 1 February 12th 04 05:23 AM


All times are GMT +1. The time now is 11:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"