如何将剪贴板的内容存储到变量中?

时间:2016-11-21 11:15:47

标签: vbscript

我想把变量放入剪贴板的文本内容! 我可以粘贴,但不能复制! 所以,我的问题是: 如何将剪贴板的内容存储到变量中?

' 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

0 个答案:

没有答案