VBA复制按钮从文本框中复制文本

Sér*_*nço 1 excel vba excel-vba

我需要创建一个复制按钮来复制我之前插入文本框中的文本,所有这些都在excell中

One*_*ide 8

假设您有一个名为TextBox且名为TextBox1CommandButton CommandButton1:

Private Sub CommandButton1_Click()
    Dim MyData As New DataObject
    MyData.SetText TextBox1.Text
    MyData.PutInClipboard
End Sub
Run Code Online (Sandbox Code Playgroud)

单击CommandButton1后,TextBox1上的文本已准备好粘贴到任何适当的位置.