' Copy Clipboard contents to Variable MyVar
Dim Copy2 As DataObject ' Declares Copy2 as an Object
Set Copy2 = New DataObject ' Sets Copy2 as a New Object
Call Copy2.GetFromClipboard ' This calls the Clipboard to Copy2
MyVar = Copy2.GetText ' This takes whatever is in clipboard to MyVar
' Writing File to C:\My Documents\File.txt
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\My Documents\File.txt", True)
a.WriteLine (MyVar) ' This is the variable contents from the clipboard. Now are being written to File.txt
a.Close