facebook twitter hatena line email

Libreoffice/表計算/マクロphp連携

提供: 初心者エンジニアの簡易メモ
2026年2月16日 (月) 15:32時点におけるAdmin (トーク | 投稿記録)による版 (ページの作成:「==引数なしであれば実行できる== <pre> Sub TestPHPScript() Dim oShell As Object oShell = CreateUnoService("com.sun.star.system.SystemShellExecute")...」)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

引数なしであれば実行できる

Sub TestPHPScript()
    Dim oShell As Object
    oShell = CreateUnoService("com.sun.star.system.SystemShellExecute")
    Dim sCmd As String
    Dim sArgs As String
    sCmd = "/opt/homebrew/bin/php"
    sArgs = "/d/www/php/test.php"
    oShell.execute sCmd, sArgs, 1
    MsgBox "called"
End Sub

引数ありだと失敗する

Sub TestPHPScript()
    Dim oShell As Object
    oShell = CreateUnoService("com.sun.star.system.SystemShellExecute")
    Dim sCmd As String
    Dim sArgs As String
    sCmd = "/opt/homebrew/bin/php"
    sArgs = "/d/www/php/test.php hello"
    oShell.execute sCmd, sArgs, 1
    MsgBox "called"
End Sub

エラーメッセージ詳細

BASIC runtime error.
An exception occurred 
Type: com.sun.star.system.SystemShellExecuteException
Message: Attribute not found.