0

I want to put into a variable, the text content of the clipboard ! I can paste, but not copy ! So, my question is : How to store the contents of the clipboard into a variable ?

' Set what you want to put in the clipboard '
strMessage = "Hello World"
' Declare an object for the word application '
Set objWord = CreateObject("Word.Application")

' Using the object '
With objWord
   .Visible = False             ' Don't show word '
   .Documents.Add               ' Create a document '
   .Selection.TypeText strMessage   ' Put text into it '
   .Selection.WholeStory        ' Select everything in the doc '
   .Selection.Copy              ' Copy contents to clipboard '
   .Quit False                  ' Close Word, don't save ' 
End With
Hackoo
  • 18,337
  • 3
  • 40
  • 70
  • Possible duplicate of [Use clipboard from VBScript](http://stackoverflow.com/q/128463/692942) – user692942 Nov 21 '16 at 11:33
  • 1
    Looks to me like you knew about these duplicates anyway, your question code is taken directly from this answer - [A: Use clipboard from VBScript](http://stackoverflow.com/a/140800/692942). The answer only mentions *"put your data onto the clipboard"* you'd be better trying one of the others like [this one that creates a class to leverage different methods to send and retrieve data from the clipboard](http://stackoverflow.com/a/8565085/692942) or [The easiest way is to use built-in mshta.exe functionality](http://stackoverflow.com/a/36991258/692942) – user692942 Nov 21 '16 at 11:42

0 Answers0