Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy variable to clipboard | Excel Programming | |||
copy and paste and clipboard contents message | Excel Programming | |||
Copy outside Clipboard contents (html page) to a cell in Excel | Excel Programming | |||
Copy outside Clipboard contents (html page) to a cell in Excel | Excel Programming | |||
Set variable to clipboard contents? | Excel Programming |