Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable to Clipboard..

Status
Not open for further replies.

basepointdesignz

Programmer
Jul 23, 2002
566
GB
Hi,

What's the best / quickest way to send a variable to the clipboard so after the program has concluded, the user can paste the variable result wherever they like?



Cheers,

Paul
basepointdesignzltd..
P4 3.0Ghz / 1.25GB RAM
XP Pro SP2
Sapphire X1950 512MB Dual-DVi Graphics Card..
 
Go to tools/references and add microsoft forms 2.0

Code:
Private Sub CommandButton1_Click()
Dim MyData As DataObject
    Set MyData = New DataObject
    Dim X As String
    
    X = "Copy me"
    
    MyData.SetText X
    MyData.PutInClipboard

    
End Sub

Chance,

Filmmaker, gentleman and ROMAN!
 
Thanks,

Will try it out. Is there no way of simply doing it without adding other references? Want to keep the program as small and thin as cross-platform as possible..

Cheers,

Paul
basepointdesignzltd..
P4 3.0Ghz / 1.25GB RAM
XP Pro SP2
Sapphire X1950 512MB Dual-DVi Graphics Card..
 
Its an AutoCAD VBA routine for getting the level / elevation of a picked point. For construction / building drawings. The user picks the point, the program displays the result in a msgbox and ask if the result is to inserted into drawing.
If yes then i want the result to be copied to the clipboard so the user can then paste it in as text or whatever. I could insert it as an autocad block with an attribute but i didn't want to complicate things more than that really..

So maybe cross-platform was the wrong thing to say, i just didn't want to bulk it out more than necessary and i want everyone here to be able to run it, and for me at home..

Cheers,

Paul
basepointdesignzltd..
P4 3.0Ghz / 1.25GB RAM
XP Pro SP2
Sapphire X1950 512MB Dual-DVi Graphics Card..
 
I think I am right in saying this , but the forms collection is included in all windows installations,

the only other way i can think of is ussing application.copy , but i am not familiar with the autocad object model

Chance,

Filmmaker, gentleman and ROMAN!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top