我想使用vba宏来复制或创建文件夹,然后我使用了FileSystem函数。我可以运行这个程序整个早上,但突然出现错误,提示找不到路径。我已经检查过我的所有路径都是正确的。我该如何解决?
Sub CreateMissingFolders(DestinationFolder As String, FolderNames As Variant)
Dim FileSystem As Object
Dim FolderName As Variant
Set FileSystem = CreateObject("Scripting.FileSystemObject")
For Each FolderName In FolderNames
If Not FolderExists(DestinationFolder & "\" & FolderName) Then
FileSystem.CreateFolder DestinationFolder & "\" & FolderName
End If
Next FolderName
End Sub
您的通行证是否变得太长?在我的记忆中,路径的最大长度约为 250 个字符
您的路径中有一些无效字符?