以下是在文件夹中搜索“需求”之类的文件夹的过程。开始单步执行时,我收到一条错误消息,原因是 FileSystemObject
:
User defined type not defined
我错过了什么?
Sub GetSubFolders()
Dim f As Folder, sf As Folder, myFile As File
Dim fso As New FileSystemObject ' <=========== ERROR HERE
Set f = fso.GetFolder("C:\Users\C58227\Desktop\Projects\CRDs")
For Each sf In f.SubFolders
For Each mySubFolder In myFolder.SubFolders
For Each myFile In mySubFolder.Files
If myFile.Name Like "Requirements" Then
MsgBox myFile.Name
Exit For
End If
Next
MsgBox "Else"
Next
Next
End Sub
最佳答案
关于excel - 如何解决错误用户定义类型未定义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45921953/