How to drag and drop a file (path) from a sharepoint library shown in the browser to a d&d control in VBA

RoMiOb

New Member
Joined
Aug 18, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,224,574
Messages
6,179,629
Members
452,933
Latest member
patv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top