Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default copy to clipboard

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default copy to clipboard

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default copy to clipboard

thanks
works great

"Peter T" <peter_t@discussions wrote in message
...
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" wrote in message
...
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
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
clipboard copy & paste SAGknot Excel Discussion (Misc queries) 1 June 12th 07 01:36 PM
Transfer clipboard from Task pane clipboard(office?) content to Excel (windows?) clipboard? tskogstrom Excel Programming 2 March 6th 07 12:50 PM
copy to the clipboard and into another workbook Mark Dvorkin Excel Discussion (Misc queries) 2 February 24th 06 02:41 AM
Copy from clipboard? G Lam[_2_] Excel Programming 1 November 24th 04 09:05 AM
Copy to windows clipboard BillShut Excel Programming 1 February 6th 04 06:51 PM


All times are GMT +1. The time now is 10:10 PM.

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"