title: Open Sharepoint Excel Files With VBA
body: <p>I'm using VBA in Excel to loop through files on a sharepoint site and open all Excel files.</p>
  
  <p>The code crashes Excel the first time I run it, however, if I then reopen it it works fine.</p>
  
  <p>Are there any known issues around this?</p>
  
  <p>Thanks.</p>
  
  <p>Edit: Here is the code:</p>
  
  <pre><code>Sub Refresh()
  
      With Application
          .ScreenUpdating = False
          .DisplayAlerts = False
  
          Dim fso As FileSystemObject
          Dim fldr As Folder
          Dim f As File
          Dim wb As Workbook
  
          Set fso = New FileSystemObject
          Set fldr = fso.GetFolder(SharePointSite)
  
          For Each f In fldr.Files
  
              Set wb = Workbooks.Open(SharePointURL &amp; f.Name)
  
          Next f
  
          Set wb = Nothing
          Set fldr = Nothing
          Set fso = Nothing
  
          .DisplayAlerts = True
          .ScreenUpdating = True
      End With
  
  End Sub
  </code></pre>