showopen只是打开对话框了,
选择文件后,打不开
应是缺些什么吧?
急等回答!谢了!

解决方案 »

  1.   

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecute A" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd A s Long) As Long
    '打开某个网址
    ShellExecute 0, "open", "http://www.dbgnu.com", vbNullString, vbNullString, 3
    '给某个信箱发电子邮件
    ShellExecute hwnd, "open", "mailto:[email protected]", vbNullString
    '用默认程序 打开文件 /或运行 程序 
    ShellExecute hwnd,"open","文件 名",vbNullString,vbNullString,3
      

  2.   

    多谢griefforyou(你伤心)了!
    不过我不懂你的思路,请详细些好吗?
      

  3.   

    showopen不能打开文件,只能获得你选择的文件。用别的方法打开。
      

  4.   

    这么说吧。你可以用commandlg得到文件名
    比如:
    dim filename1 as string 
    filename1=commondialog.filename
    shell(filename)
    就是这样的
      

  5.   

    Private 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
    Private Sub Command1_Click()
    Dim aa As Stringcdl.ShowOpen
    aa = cdl.FileNameShellExecute hwnd, "open", "aa", vbNullString, vbNullString, 3End Sub
    但是仍打不开文件
    初涉VB还请高手多指教!
      

  6.   

    请问为什么这样还不行呢?
    Private Sub Command1_Click()
    Dim aa As Double
    Dim name
    cdl.ShowOpen
    name = cdl.FileName
    ‘MsgBox name
    aa = Shell("name", vbNormalFocus)End Sub
      

  7.   

    最后一句应该是
    aa=shell(name,vbNormalFocus)
    0A还有,你这样只能打开.exe文件,如果要打开任意文件的话,应该是
    aa=shell("start " & trim(name),vbNormalFocus)
    0A