Hello,
I was already searching for quite a while in the www but haven't even found anything where someone else had the same problem. Maybe I used the wrong search key words. If this is an old topic, already solved long time ago then please pont me to the site where I can find the solution.
I would like to allow the user to pick a file/files from a sharepoint library shown in the browser and drop it on a drag and drop capable control on a form in my excel/vba.
It works fine when I pick the file/files from the file explorer but does not work with a bowser (already tried with IE, Edge, Chrome) Doing it causes an exception with the error message "runtime error 461 = specified format doesn't match format of data". What do I have to change to get it running?
That is my sub where the trouble happens
(it receives the data from the drop and then puts the path in a listbox together with the info if it was a folder or file (both checked in extra functions using FSO). Finally it also shows the new number of files in the listbox.)
Private Sub lv_DragNDrop_OLEDragDrop(data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim s As Variant
For Each s In data.Files
lbx_Files.AddItem s
If (FolderExists2(s)) Then
lbx_Files.Column(1, lbx_Files.ListCount - 1) = "Folder"
ElseIf (FileExists2(s)) Then
lbx_Files.Column(1, lbx_Files.ListCount - 1) = "File"
Else
lbx_Files.Column(1, lbx_Files.ListCount - 1) = ""
End If
Next s
lbl_FileCount = lbx_Files.ListCount
End Sub
I was already searching for quite a while in the www but haven't even found anything where someone else had the same problem. Maybe I used the wrong search key words. If this is an old topic, already solved long time ago then please pont me to the site where I can find the solution.
I would like to allow the user to pick a file/files from a sharepoint library shown in the browser and drop it on a drag and drop capable control on a form in my excel/vba.
It works fine when I pick the file/files from the file explorer but does not work with a bowser (already tried with IE, Edge, Chrome) Doing it causes an exception with the error message "runtime error 461 = specified format doesn't match format of data". What do I have to change to get it running?
That is my sub where the trouble happens
(it receives the data from the drop and then puts the path in a listbox together with the info if it was a folder or file (both checked in extra functions using FSO). Finally it also shows the new number of files in the listbox.)
Private Sub lv_DragNDrop_OLEDragDrop(data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim s As Variant
For Each s In data.Files
lbx_Files.AddItem s
If (FolderExists2(s)) Then
lbx_Files.Column(1, lbx_Files.ListCount - 1) = "Folder"
ElseIf (FileExists2(s)) Then
lbx_Files.Column(1, lbx_Files.ListCount - 1) = "File"
Else
lbx_Files.Column(1, lbx_Files.ListCount - 1) = ""
End If
Next s
lbl_FileCount = lbx_Files.ListCount
End Sub