我在 Excel 中使用 VBA 循环浏览共享点站点上的文件并打开所有 Excel 文件。
该代码在我第一次运行 Excel 时会崩溃,但是,如果我随后重新打开它,它就可以正常工作。
是否有任何已知问题?
谢谢。
编辑:这是代码:
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 & f.Name)
Next f
Set wb = Nothing
Set fldr = Nothing
Set fso = Nothing
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub