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

Hi everyone,

My head has gone blank. I am trying to copy the contents of a variable into
the clipboard.

ie:
value in clipboard = MyVariable

Can someone please remind me?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Copy contents of variable into clipboard

What do you intend to do with the variable?

Wouldn't there be better methods to use, then?

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Simka" wrote:

Hi everyone,

My head has gone blank. I am trying to copy the contents of a variable into
the clipboard.

ie:
value in clipboard = MyVariable

Can someone please remind me?

  #3   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default Copy contents of variable into clipboard

On Oct 28, 10:59*am, Simka wrote:
Hi everyone,

My head has gone blank. I am trying to copy the contents of a variable into
the clipboard.

ie:
value in clipboard = MyVariable

Can someone please remind me?


Try the following...ron

Dim mystring As New DataObject

my_var= "assign something to the variable"

mystring.SetText my_var
mystring.PutInClipboard
ActiveSheet.PasteSpecial Format:="Text"
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copy the contents of variable into clipboard

Hi ron,

I'm not sure how to understand what you have written below, but I think you
are on the right lines and understanding what I am trying to achieve.

I'm not too familiar with Class Modules, I find them a little confusing. Can
you write the code in full so that I can copy it to modules/class modules and
then I can follow what you are thinking?

Cheers,

Simka.


"ron" wrote:

On Oct 28, 10:59 am, Simka wrote:
Hi everyone,

My head has gone blank. I am trying to copy the contents of a variable into
the clipboard.

ie:
value in clipboard = MyVariable

Can someone please remind me?


Try the following...ron

Dim mystring As New DataObject

my_var= "assign something to the variable"

mystring.SetText my_var
mystring.PutInClipboard
ActiveSheet.PasteSpecial Format:="Text"

  #5   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default Copy the contents of variable into clipboard

On Oct 29, 8:40*am, Simka wrote:
Hi ron,

I'm not sure how to understand what you have written below, but I think you
are on the right lines and understanding what I am trying to achieve.

I'm not too familiar with Class Modules, I find them a little confusing. Can
you write the code in full so that I can copy it to modules/class modules and
then I can follow what you are thinking?

Cheers,

Simka.



"ron" wrote:
On Oct 28, 10:59 am, Simka wrote:
Hi everyone,


My head has gone blank. I am trying to copy the contents of a variable into
the clipboard.


ie:
value in clipboard = MyVariable


Can someone please remind me?


Try the following...ron


* * Dim mystring As New DataObject


* * my_var= "assign something to the variable"


* * mystring.SetText my_var
* * mystring.PutInClipboard
* * ActiveSheet.PasteSpecial Format:="Text"- Hide quoted text -


- Show quoted text -


Hi Simka...Just copy and paste the following code into a module.
Assign whatever it is that you want to move to the clipboard to
"my_var". The ActiveSheet.Paste line simply demonstrates that you
have copied the information to the clipboard. Change or delete this
line depending on what you want to do with the information once it is
in the clipboard...ron

Sub CopyToClipboard()

Dim mystring As New DataObject

my_var = "assign something to the variable"

mystring.SetText my_var
mystring.PutInClipboard

ActiveSheet.PasteSpecial Format:="Text"

End Sub


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Copy the contents of variable into clipboard



"ron" wrote:

On Oct 29, 8:40 am, Simka wrote:
Hi ron,

I'm not sure how to understand what you have written below, but I think you
are on the right lines and understanding what I am trying to achieve.

I'm not too familiar with Class Modules, I find them a little confusing. Can
you write the code in full so that I can copy it to modules/class modules and
then I can follow what you are thinking?

Cheers,

Simka.



"ron" wrote:
On Oct 28, 10:59 am, Simka wrote:
Hi everyone,


My head has gone blank. I am trying to copy the contents of a variable into
the clipboard.


ie:
value in clipboard = MyVariable


Can someone please remind me?


Try the following...ron


Dim mystring As New DataObject


my_var= "assign something to the variable"


mystring.SetText my_var
mystring.PutInClipboard
ActiveSheet.PasteSpecial Format:="Text"- Hide quoted text -


- Show quoted text -


Hi Simka...Just copy and paste the following code into a module.
Assign whatever it is that you want to move to the clipboard to
"my_var". The ActiveSheet.Paste line simply demonstrates that you
have copied the information to the clipboard. Change or delete this
line depending on what you want to do with the information once it is
in the clipboard...ron

Sub CopyToClipboard()

Dim mystring As New DataObject

my_var = "assign something to the variable"

mystring.SetText my_var
mystring.PutInClipboard

ActiveSheet.PasteSpecial Format:="Text"

End Sub


Hi ron,

Ah-ha, this is better. this is what I'm nearly trying to get to. I vaguely
seem to remember years ago I had the same sort of problem but I used a
totally different approach, maybe one day I'll remember how I did it.

Anyway I've slightly adjusted your code to accommodate my needs.

Have a look at my reply to Wigi, this may help you understand more or less
what I was trying to achieve. This was so that I could select a number of
different cells (with values), add all the values and and hold the result in
a variable for later use and I also wanted to hold the result in the
clipboard instead of placing the result in a cell.

Cheers & thanks,

Simka.

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
Copy variable to clipboard Greg Glynn Excel Programming 3 January 8th 08 12:55 AM
copy and paste and clipboard contents message dr chuck Excel Programming 3 June 25th 06 04:31 PM
Copy outside Clipboard contents (html page) to a cell in Excel sifar Excel Programming 9 September 12th 05 11:46 PM
Copy outside Clipboard contents (html page) to a cell in Excel sifar Excel Programming 2 September 3rd 05 03:40 AM
Set variable to clipboard contents? Fred Smith Excel Programming 2 September 5th 04 08:23 PM


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