kpasa
Board Regular
- Joined
- Nov 20, 2015
- Messages
- 82
I have a userform with a TreeView being used as a "Drag and Drop" file input. The goal is to have the userform automatically accept that file and copy it to a specified folder.
So far i have this code in my userform_activate:
And then the 'Private Sub TreeView1_OLEDragDrop' event
For this proof of concept, I have it only displaying the file's path. I will eventually get to the rest of the code. So far it works fine with a file from File Explorer.
My problem is that I often am filing attachments from outlook emails. But when try to drag an attachment over, i get the following error:
"Run-time error '461': Specified format doesn't match format of data"
Any thoughts on how I can address this error?
So far i have this code in my userform_activate:
Code:
TreeView1.OLEDropMode = ccOLEDropManual
TreeView1.OLEDragMode = ccOLEDropManual
And then the 'Private Sub TreeView1_OLEDragDrop' event
Code:
Private Sub TreeView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim StrPath As String
StrPath = Data.Files(1)
MsgBox StrPath
End Sub
For this proof of concept, I have it only displaying the file's path. I will eventually get to the rest of the code. So far it works fine with a file from File Explorer.
My problem is that I often am filing attachments from outlook emails. But when try to drag an attachment over, i get the following error:
"Run-time error '461': Specified format doesn't match format of data"
Any thoughts on how I can address this error?
Last edited: