Simplest Imaginable Question re "Copy" or similar

V

veryeavy

Hi All,

Nice easy one for you guys from an Excel interloper.

In Word I have written the following macro:

---------------------------------------------------------------------------------
Sub copy_Disco3_Password()

Dim Disco3PWord As String

Disco3PWord = "Chinese_Democracy" '2008 Album of the Year

<< your answer goes here >>

End Su
---------------------------------------------------------------------------------

What do I need to write to copy this variable to the clipboard (so that I
can paste it into the logoin dialog of this app)?

First correct answer will be awarded a big green tick (not to mention my
gratitude).

TIA and Best regards,

Matt
 
G

Greg Maxey

Sub MyCopyToClipBoard()
'Must have a reference to Microsoft Forms 2.0 Object Library enabled
Dim myCopy As DataObject
Dim Disco3PWord As String
Disco3PWord = "Chinese_Democracy"
Set myCopy = New DataObject
myCopy.SetText Disco3PWord
myCopy.PutInClipboard
End Sub
 
V

veryeavy

Many Thanks Greg - rather more to it than I realised so your help was
invaluable.
 
Top