PC Review


Reply
Thread Tools Rate Thread

copy to clipboard

 
 
greg
Guest
Posts: n/a
 
      19th Sep 2008
This should be easy.
I want to select a cell. then copy the comment from a cell into the
clipboard.

To get the comment I can
Excel.Selection.Comment.Text


for copying to the clipboard. Googline I see a clipboard object. people
use:
Clipboard.setText

but clipboard is not an object for me.
Do you have to add a reference in?
dim it as something?

thanks


 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      19th Sep 2008
If you don't already have a userform, add one and then you can delete it
(just a quick way to add the necessary Reference for DataObject).

Sub ComToClipBrd()
Dim sComText As String
Dim dtaObj As DataObject

On Error Resume Next
sComText = ActiveCell.Comment.Text
On Error GoTo 0

If Len(sComText) Then
Set dtaObj = New DataObject
dtaObj.SetText sComText
dtaObj.PutInClipboard

MsgBox sComText, , "put in clipboard"
End If

End Sub

Regards,
Peter T

"greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This should be easy.
> I want to select a cell. then copy the comment from a cell into the
> clipboard.
>
> To get the comment I can
> Excel.Selection.Comment.Text
>
>
> for copying to the clipboard. Googline I see a clipboard object. people
> use:
> Clipboard.setText
>
> but clipboard is not an object for me.
> Do you have to add a reference in?
> dim it as something?
>
> thanks
>



 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      19th Sep 2008
thanks
works great

"Peter T" <peter_t@discussions> wrote in message
news:(E-Mail Removed)...
> If you don't already have a userform, add one and then you can delete it
> (just a quick way to add the necessary Reference for DataObject).
>
> Sub ComToClipBrd()
> Dim sComText As String
> Dim dtaObj As DataObject
>
> On Error Resume Next
> sComText = ActiveCell.Comment.Text
> On Error GoTo 0
>
> If Len(sComText) Then
> Set dtaObj = New DataObject
> dtaObj.SetText sComText
> dtaObj.PutInClipboard
>
> MsgBox sComText, , "put in clipboard"
> End If
>
> End Sub
>
> Regards,
> Peter T
>
> "greg" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> This should be easy.
>> I want to select a cell. then copy the comment from a cell into the
>> clipboard.
>>
>> To get the comment I can
>> Excel.Selection.Comment.Text
>>
>>
>> for copying to the clipboard. Googline I see a clipboard object. people
>> use:
>> Clipboard.setText
>>
>> but clipboard is not an object for me.
>> Do you have to add a reference in?
>> dim it as something?
>>
>> thanks
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clipboard gets empty by itself, cleared clipboard, copy paste doesn't work, outlook clears clipboard, problems with clipboard - possible solution Jens Hoerburger Microsoft Outlook 0 24th Aug 2006 02:44 PM
How do I disable Office Clipboard so Copy Paste uses traditional Windows Clipboard dwilliamson@ivsi.com Microsoft Excel Discussion 10 24th Feb 2005 02:36 PM
Using VB.Net or C#, utilizing the clipboard object, how to copy an MS Excel graphic from the clipboard to an image control and obtain its source reference TC Microsoft Dot NET 5 1st Sep 2004 05:49 AM
Using VB.Net or C#, utilizing the clipboard object, how to copy an MS Excel graphic from the clipboard to an image control and obtain its source reference TC Microsoft Dot NET Framework 5 1st Sep 2004 05:49 AM
Using VB.Net or C#, utilizing the clipboard object, how to copy an MS Excel graphic from the clipboard to an image control and obtain its source reference TC Microsoft C# .NET 2 27th Jul 2004 06:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:21 AM.