1. 复制文本到剪切板
需要参照【Microsoft Forms 2.0 Object Library】
Option Explicit
Function SetCB(ByVal text As String)
With CreateObject("Forms.TextBox.1")
.MultiLine = True
.text = text
.SelStart = 0
.SelLength = .TextLength
.Copy
End With
End Function
2. 使用方法
Sub Copy()
Dim strContext As String
strContext = "测试文本"
Call SetCB(strContext)
End Sub