Sub Test()
path1 = ThisWorkbook.Path
AppActivate Shell(path1 & "\B\" & "A.exe")
End Sub
結果 是找不到檔案
但用
Dim fso, As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(path1 & "\B\" & "A.exe") Then
msgbox "OK"
End If
卻 存在OK 但無法執行 因為找不到檔案
應如何修正語法?
謝謝指導作者: yangjie 時間: 2014-12-5 08:48
回復 1#yangjie
在各種錯誤中學習
Sub test()
Dim path1 As String
path1 = ThisWorkbook.Path & "\" & "資料庫"
ChDir path1
Dim myret As Long
myret = Shell("B.exe", 1)
AppActivate myret
End Sub
就OK了