文件我有VBA中寫入一個文本到.txt
文件子程序:寫入在VBA長名稱爲Mac
Sub WriteToFile(fileName as String, content as String)
Open fileName For Output As #1
Print #1, content
Close #1
End Sub
這個子程序工作得很好Windows下。但是,我意識到在Mac下,對於任何超過29個字符的targeFile
,將在線路Open fileName For Output As #1
上提出錯誤Bad file name or number
。
但我需要寫大量的文件,其名稱是長的...
其實,這個問題是很常見的。例如,this link也提到There are problems with long file names when you use Dir on a Mac, 27/28 characters (without the ext) is the maximum(with the extension this is 32 characters).
看來AppleScript
可能是一個解決方案。但由於我正在尋找的解決方法,請寫而不是Dir
,我還沒有找到寫入的精確解決方案。
有誰知道如何做到這一點?