初學者!使用 VBA 在 Mac 上創建檔案時出現問題。我復制了檔案夾路徑名,但它不起作用。錯誤說 - “錯誤的檔案名或編號”。我懷疑問題出在路徑名內,如果是這樣,正確的方法是什么?
Public Sub task()
Open "/Users/user/test.csv" For Output As file
Close file
End Sub
uj5u.com熱心網友回復:
有關 Open 的檔案,請參閱:https : //docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/open-statement
在你的情況下:
Public Sub task()
Open "/Users/user/test.csv" For Output As #1
' do whatever output you need here, then ...
Close #1
End Sub
由于 Apple 的沙盒機制,檔案路徑可能存在其他問題,但請先嘗試上述方法。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/351348.html
