将变量的内容复制到剪贴板VBA(Excel 2013) [英] Copy Variable's Contents to Clipboard VBA (Excel 2013)

查看:153
本文介绍了将变量的内容复制到剪贴板VBA(Excel 2013)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这应该是一个超级简单的解决方案,但是我无法理解.

I know this should be a super easy solution but I can't fathom it out.

我只是制作一个简单的按钮,将输出"范围内的值复制到剪贴板.

I'm just making a simple button which copies the values in the range of 'Output' to my clipboard.

Private Sub CommandButton1_Click()
Dim Output As String
    Output = Range("Output")
    MsgBox (Output + " Text has been copied")
End Sub

我希望输出复制到剪贴板.

I want Output to copy to my clipboard.

非常感谢山姆

推荐答案

我对它做了180度的调整,

I did a 180 on it and changed it around,

下面的解决方案:

Private Sub CommandButton1_Click()
Dim myData As DataObject
Dim Output As String

Output = UCase(InputBox("Type Text Here"))

If Output = "" Then
End
Else
End If
Set myData = New DataObject
myData.SetText Output
myData.PutInClipboard
MsgBox (Output + " text has been copied")
End Sub

这篇关于将变量的内容复制到剪贴板VBA(Excel 2013)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆