この質問はこれまでに依頼されていますが、「Office 2011 for Mac for Mac」のVBA Shell機能に対する回答がうまくいかないようです。VBA(Office 2011 for Mac)でAppleScriptを実行する方法はありますか?
私のApplescript、Run_Script.scptは、小さなtxtファイルを作成します。これはエディタで完全に動作します。また、アプリケーションとしてコンパイルしてデスクトップ上でダブルクリックすると、完全に実行されます。
私はVBAプロシージャから呼び出す必要があります。私はこれらを試しました:
Sub sub_scripttest()
Dim i As Integer
Dim result_long As Long
Dim result_str As String
'//== the original question was this:
result_str = Shell("Macintosh HD:Applications:Run_Script.app", vbNormalFocus)
result_str = Shell("Macintosh HD/Applications/Run_Script.app", vbNormalFocus)
'//== gives a modal dialog box: "Runtime error 53: File not found"
'//== the suggested solution was this:
result_str = MacScript("do shell script ""Macintosh HD:Applications:Run_Script.app""")
result_str = MacScript("do shell script ""Macintosh HD/Applications/Run_Script.app""")
'//== gives a modal dialog box: "Runtime error 5: Invalid Procedure call or Argument"
'//== another suggested solution was this:
result_long = system("Macintosh HD:Applications:Run_Script.app")
result_long = system("Macintosh HD/Applications/Run_Script.app")
'//== appears to run, but returns result_long=32512, which is not a successful termination code.
'//== also the desktop shows that the script did not run. The txt file was not created.
'//== I even tried:
result_str = AppleScriptTask("Run_Script.scpt", "my_command", "")
'//== and got: "Compile Error: Sub or Function not defined."
End Sub
私はOS Xエルキャピタン10.11.6を持っています。私はOffice 2011 for Macを実行しています。 Excelが14.7.2に更新されました
何が間違っていますか?
これらの仕事を完璧に!どうもありがとうございました! –