Userform - 文件拖放到ListBox中 [英] Userform - Files Drag&Drop into a ListBox
本文介绍了Userform - 文件拖放到ListBox中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在Userform中实现一个宏来自动生成带附件的邮件。
原则是拖动附件将文件放入一个ListBox,它将获取文件链接。
I try to realize a macro in an Userform to automatically generate a mail with attachments.
The principle is to drag attachment files into a ListBox that will grab the file link.
使用以下代码进行文本拖放操作(在网上恢复,所以我完全不理解)
The text drag&drop is ok with the following code (recover on the net so I don't understand it completely)
我的问题:此代码不适用于文件链接。
My problem : This code doesn't work with file links.
我认为"GetText"是不适合我,但我不知道如何更换它...
I think "GetText" is not appropriate for me but I don't know how replace it...
请帮帮我!!
Vlv35
Private Sub ListBox1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, _
ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal y As Single, _
ByVal DragState As Long, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = 1
End Sub
Private Sub ListBox1_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, _
ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, _
ByVal X As Single, ByVal y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = 1
ListBox1.AddItem Data.GetText
End Sub
推荐答案
strPath = Data.Files(1)
见
VBA将文件拖放到用户表单以获取文件名和路径以获取更多信息。
这篇关于Userform - 文件拖放到ListBox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文