2017-09-23 11 views
0

ブックをMac上のデスクトップに保存するためのマクロを記録しましたが、ユーザー名にVBA environ $(username)のような変数名を作る方法がわかりませんMACの可変ユーザー名は何ですか

ActiveWorkbook.SaveAs Filename:="/Users/username/Desktop/test.xls", _ 

なFileFormat:= xlExcel8、パスワード:= ""、WriteResPassword:= ""、_ ReadOnlyRecommended:= CreateBackup、偽:= Falseの

AppleScriptでは
+0

可能重複https://stackoverflow.com/questions/1104972/how-do-i-get-the - アクティブユーザ名 - コマンドライン - インos-x –

+0

[OS Xのコマンドラインからアクティブユーザの名前を取得するにはどうすればいいですか?](https ://stackoverflow.com/questions/1104972/how-do-i-get-the-name-of-the-active-user-via-the-command-line-in-os-x) –

答えて

0

あなたは変数を設定することができ、例えばユーザーのデスクトップのパスとファイル名として、例えば:

set theFilename to POSIX path of (path to desktop as string) & "filename.xls" 

は、さまざまな場所のすべてのために、path to (folder)のためのAppleScriptのドキュメントを見ているとtheFilenameは、このフォームを適用することが可能です。

それだけで、ユーザーが希望の名の場合:

set theShortUserName to short user name of (get system info) 

それとも

set theShortUserName to do shell script "printf $USER" 
関連する問題