我知道如何在Windows计算机上执行此操作。这是windows的代码:
Sub delete_contents_of_Sallima_folder()
Dim FSO As Object
Dim MyPath As String
Set FSO = CreateObject("scripting.filesystemobject")
MyPath = ActiveWorkbook.path & "\Sallima"
If Right(MyPath, 1) = "\" Then
MyPath = Left(MyPath, Len(MyPath) - 1)
End If
If FSO.FolderExists(MyPath) = False Then
MsgBox MyPath & " doesn't exist"
Exit Sub
End If
On Error Resume Next
'Delete files
FSO.deletefile MyPath & "\*.*", True
'Delete subfolders
FSO.deletefolder MyPath & "\*.*", True
On Error GoTo 0
End Sub
但是这条线在Mac上显示错误:
Set FSO = CreateObject("scripting.filesystemobject")
运行时错误“429 Active X组件无法创建对象“
如何在Mac中完成任务?请帮帮我。