使用活动X控制按钮,将超链接从剪贴板粘贴到活动单元格上?
我从剪贴板上粘贴超链接问题有问题。目的是使用一个活动X按钮粘贴剪贴板上的手/鼠标复制的超链接,该超链接位于我的工作表上的“活动单元格”中。该工作表受保护,因此按钮必须取消保护工作表,运行代码以粘贴剪贴板的超链接,然后保护工作表。在这个问题上的任何帮助将不胜感激。
基本思想:(我知道此代码不正确,只将其用作对话启动器)。
Private Sub CommandButton10_Click()
ActiveSheet.Unprotect Password:="Password1"
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.GetFromClipboard
strPaste = DataObj.GetText(1) <<<<certain something is missing after this line
ActiveCell.Paste Link:=True
ActiveSheet.Protect Password:="Password1"
End Sub
I am having issues with pasting a hyperlink from my clipboard. The goal is to use an Active X button to paste a hand/mouse copied hyperlink that is sitting on the clipboard into the "Active Cell" on my worksheet. The worksheet is protected, so the button must unprotect the sheet, run the code to paste the hyperlink from the clipboard, then protect the sheet. Any help on this issue would be greatly appreciated.
Basic Idea: (I know this code is not correct, only using it as a conversation starter).
Private Sub CommandButton10_Click()
ActiveSheet.Unprotect Password:="Password1"
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.GetFromClipboard
strPaste = DataObj.GetText(1) <<<<certain something is missing after this line
ActiveCell.Paste Link:=True
ActiveSheet.Protect Password:="Password1"
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MSFORM被弃用。使用
您这样称呼它:
在代码模块中,请准确添加以下所有行...
MSForms is deprecated. Use this function instead:
You call it like this:
In a code module please add all of the following lines exactly...