I need to write a macro to open all the files in a libray on a SharePoint. I found the code below which looks very straightforward but I get the error "User-defined type not defined" for each of the Dim statements. It appears that I need to add some references, but can anyone tell me what references I need to select to make this code work?
Public Sub ListFiles()
Dim folder As folder
Dim f As File
Dim fs As New FileSystemObject
Dim RowCtr As Integer
RowCtr = 1
Set folder = fs.GetFolder("\\SP\Path\MorePath\DocumentLibrary\Folder")
For Each f In folder.Files
Cells(RowCtr, 1).Value = f.Name
RowCtr = RowCtr + 1
As an alternative is there a method that does not require adding references? I have also seen suggestions that mapping the sharepoint to a drive letter would be helpful but this is not an optimum solution as many people will eventually use this tool and it is not likely that they can all map the same drive letter.
Any suggestions or tips would be much appreciated.