PDA

View Full Version : .AllowMultiSelect = True works intermittently



tippuraj
08-01-2016, 10:34 AM
I have below code used to connect to SharePoint folder and multi-select files, however sometimes it works and sometimes it doesn't allow me to select multiple files and i can select only one file. This code works fine when i have to select files from local drive.

Any idea why "fd.AllowMultiSelect = True" works intermittently


Set fd = Application.FileDialog(msoFileDialogFilePicker)

fd.InitialFileName = FileFolder & "\"
fd.InitialView = msoFileDialogViewList
fd.Filters.Add "Excel files (*.xls; *.xlsm; *.xlsx)", "*.xls;*.xlsm;*.xlsx"
fd.Title = "Choose Files from SharePoint"
fd.AllowMultiSelect = True

FileChosen = fd.Show

If FileChosen = -1 Then

For i = 1 To fd.SelectedItems.Count

dummyFile = Replace(fd.SelectedItems(i), "%20", " ")
tempfilepath = Left(dummyFile, InStrRev(dummyFile, "/"))
ActiveCell.value = "SP:File(" & Replace(dummyFile, tempfilepath, "") & ")"
ActiveCell.offset(0, 5).value = "Yes"
ActiveCell.offset(1, 0).Select

Next i

End If

GTO
08-03-2016, 02:10 AM
Greetings tippuraj and welcome to VBAExpress :hi:

I am afraid I will be of no help, as I could not replicate the issue. I tried on both a local and network drive, with fd declared as FileDialog.

Mark

tippuraj
08-04-2016, 01:29 AM
Greetings tippuraj and welcome to VBAExpress :hi:

I am afraid I will be of no help, as I could not replicate the issue. I tried on both a local and network drive, with fd declared as FileDialog.

Mark

Thanks Mark. not sure if its something to do with missing Microsoft library in office 2007. the only difference I see is the dialog window difference as attached in the screenshots for both cases.