Dim b As Variant
    b = ShellExecute(Me.hwnd, vbNullString, "c:\windows\calc.exe", vbNullString, vbNullString, 1)       '调用计算器

解决方案 »

  1.   

    为什么不用Shell?
    Dim RetValRetVal = Shell("C:\WINDOWS\CALC.EXE", 1)   '
      

  2.   

    shell App.path + "\a.exe"
      

  3.   

    lihonggen0(用VB):你好,我在表单里放了一个按钮,然后加入代码怎么不能执行啊?
    Private Sub Command1_Click()
    Dim b As Variant
        b = ShellExecute(Me.hWnd, vbNullString, "c:\windows\calc.exe", vbNullString, vbNullString, 1)      '调用计算器
    End Subdbcontrols(泰山):你好,
    Private Sub Command1_Click()
      Dim b As VariantDim RetValRetVal = Shell("C:\WINDOWS\CALC.EXE", 1)  ' 
    End Sub
    怎么也会出现错误?
      

  4.   

    '以下代码在模块里声明
    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
        
      

  5.   

    lihonggen0(用VB),你好,我试成功了,谢谢!