路径在PC上但不是Mac [英] Path working on PC but not Mac

查看:112
本文介绍了路径在PC上但不是Mac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Mac电脑上的VBA代码有问题。它在Windows上正常工作。我知道它与指定目录有关,但我不确定正确的语法。

工作簿在一个文件夹中,然后我想指定另一个文件夹(Datatextfiles),它是相同的文件夹作为工作簿。

 '更改路径
Dim strPath As String
Dim MyDir As String
MyDir = ActiveWorkbook.Path
strPath = MyDir& / Datatextfiles /

Dim strExtension As String

'停止屏幕闪烁
Application.ScreenUpdating = Falsew

'更改扩展名
strExtension = Dir(strPath&* .txt)

clearData

尽管strExtension<>


解决方案

Mac上的文件夹分隔符的正确名称是一个冒号:如

  ChDirKathyStringHD:Library:WebServer:Documents :DispatchReports:InTime:


I am having a problem with my VBA code on my mac computer. It works fine on Windows. I know it has something to do with specifying directory but I'm not sure on the right syntax.
The workbook is in a folder and then I want to specify another folder (Datatextfiles) which is in the same folder as the work book.

'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 <> ""

解决方案

NOne of y'all are right. The proper designation for a folder separator on mac is a colon ':' Such as

ChDir "KathyStringHD:Library:WebServer:Documents:DispatchReports:InTime:"

这篇关于路径在PC上但不是Mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆