VBS實(shí)現(xiàn)將字符串寫(xiě)入剪切板的實(shí)現(xiàn)代碼

字號(hào):


    VBS實(shí)現(xiàn)將字符串寫(xiě)入剪切板的實(shí)現(xiàn)代碼,需要的朋友可以參考下。
    函數(shù)代碼:
    代碼如下:
    Sub CopyString(s)
    Set forms=WScript.CreateObject("forms.form.1")
    Set textbox=forms.Controls.Add("forms.textbox.1").Object
    With textbox
    .multiline=True
    .text=s
    .selstart=0
    .sellength=Len(.text)
    .copy
    End With
    End Sub
    '調(diào)用
    代碼如下:
    CopyString "腳本之家 www.jb51.net"
    完整測(cè)試代碼
    代碼如下:
    Sub CopyString(s)
    Set forms=WScript.CreateObject("forms.form.1")
    Set textbox=forms.Controls.Add("forms.textbox.1").Object
    With textbox
    .multiline=True
    .text=s
    .selstart=0
    .sellength=Len(.text)
    .copy
    End With
    End Sub
    CopyString "腳本之家 www.jb51.net"
    msgbox "ok"