我曾尝试添加对我的项目的引用,以便解决此错误,但我没有成功。
谁能告诉我应该添加哪些库?
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim ws As Worksheet
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set ws = Worksheets.Add
'Get the folder object associated with the directory
Set objFolder = objFSO.GetFolder("C:\")
ws.Cells(1, 1).Value = "The files found in " & objFolder.Name & "are:"
'Loop through the Files collection
For Each objFile In objFolder.Files
ws.Cells(ws.UsedRange.Rows.Count + 1, 1).Value = objFile.Name
MyFile = objFile.Name
NewName = getNewFileName()
最佳答案
如果您在 Word IDE 中工作,则转到工具 -> 引用 并浏览 Microsoft Excel [版本号] 对象库:
关于vba - 用户类型未定义工作表 VBA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15466331/