Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 623
Default Set variable to clipboard contents?

Is it possible to set a variable to the contents of the clipboard? That is,
what is the VBA equivalent of MyVar = Ctrl-V?

--
Thanks,
Fred



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default Set variable to clipboard contents?

look up GetFromClipboard Method. Copies data from the Clipboard to a
DataObject. Your variable has to be a DataObject. You ca transfer from that
to other variable types.


"Fred Smith" wrote in message
...
Is it possible to set a variable to the contents of the clipboard? That

is,
what is the VBA equivalent of MyVar = Ctrl-V?

--
Thanks,
Fred





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Set variable to clipboard contents?

Fred.

First, set a reference to the MSForms library (in VBA, Tools
menu, then References), and use code like the following:

Dim DataObj As New MSForms.DataObject
Dim S As String
DataObj.GetFromClipboard
S = DataObj.GetText
Debug.Print S

See also www.cpearson.com/excel/clipboar.htm .

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Fred Smith" wrote in message
...
Is it possible to set a variable to the contents of the
clipboard? That is,
what is the VBA equivalent of MyVar = Ctrl-V?

--
Thanks,
Fred





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
how do I keep clipboard contents active in excel? Gunchla Excel Discussion (Misc queries) 1 January 30th 06 02:49 PM
Clear clipboard contents Cordobes Excel Discussion (Misc queries) 4 November 22nd 05 02:41 AM
Paste contents of windows clipboard into a vba 2d array? Flystar[_16_] Excel Programming 1 May 29th 04 03:18 AM
Dump of all variable contents Bernie Deitrick Excel Programming 0 February 20th 04 04:18 PM
Clipboard contents Basil[_2_] Excel Programming 0 October 8th 03 06:05 PM


All times are GMT +1. The time now is 12:29 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"