title: Getting filenames from a folder in Sharepoint with VBA
body: <p>I've done alot of research on this and found a number of help sites but still can't understand why this sometimes doesn't work.</p>
  
  <p>I'm trying to access a sharepoint site (to which there are no restrictions for me) and extract all the files in a folder within that site. </p>
  
  <p>Sometimes my Path works and it does it, other times it does not. I have a feeling it works if I've gone into the sharepoint site on my browser before but can't confirm that (because I just tried it again now and it doesnt work ARGGH). But the same code below has worked in the past.</p>
  
  <p>It's failing on the File System Object function below</p>
  
  <pre><code>Public Function GetFullFileName(strfilepath As String, _
  strFileNamePartial As String) As String
  Dim objFS As Variant
  Dim objFolder As Variant
  Dim objFile As Variant
  Dim intLengthOfPartialName As Integer
  Dim strfilenamefull As String
  Set objFS = CreateObject("Scripting.FileSystemObject")
  Set objFolder = objFS.GetFolder(strfilepath)
  'work out how long the partial file name is
  intLengthOfPartialName = Len(strFileNamePartial)
  
  For Each objFile In objFolder.Files
      'Test to see if the file matches the partial file name
      If Left(LCase(Replace(objFile.Name, " ", "")), intLengthOfPartialName) = LCase(strFileNamePartial) Then
      'get the full file name
          strfilenamefull = objFile.Name
          Exit For
      Else
      End If
  Next objFile
  
  'Return the full file name as the function's value
  GetFullFileName = strfilenamefull
  End Function
  </code></pre>
  
  <p>I get a "Run-time error '76': Path not found" when it gets to the GetFolder(strfilepath) code</p>
  
  <p>The strfilepath is just a regular sharepoint site name (e.g. like \teams.uk\gm\FX\SharedDocuments\London\11) November 2013\20 November\Reports)</p>
  
  <p>As mentioned I've tried different variations of the file path including DavWWW but nothing seems to work and I dont know what else to try.</p>
  
  <p>Any advice please?</p>
  
  <p>Thanks</p>
  
  <p>Raiyan </p>