我的 Mac 计算机上的 VBA 代码有问题。它在 Windows 上运行良好。我知道这与指定目录有关,但我不确定正确的语法。
工作簿位于一个文件夹中,然后我想指定另一个文件夹(Datatextfiles),该文件夹与工作簿位于同一文件夹中。
'Change Path
Dim strPath As String
Dim MyDir As String
MyDir = ActiveWorkbook.Path
strPath = MyDir & "/Datatextfiles/"
Dim strExtension As String
'Stop Screen Flickering
Application.ScreenUpdating = Falsew
'Change extension
strExtension = Dir(strPath & "*.txt")
clearData
Do While strExtension <> ""