用shell 函数。
或且用api 函数shellexe....后面不记得了。

解决方案 »

  1.   

    有好几种做法。
    VB的Shell函数是不能加参数调用的,只能用API,ShellExecute。
    还有一种方法,比如说你是要操纵Word文档,那么可以用Word提供的自动化对象,很方便。
    set oWordApp = CreateObject("Word.Application")
    set oDoc = oWordApp.Documents.Open sfilename
    很简单。
      

  2.   

    dim ExcelPath as String 
    dim ExcelFileName as string 
    ExcelFileName="abc.XLS"   '要打开的文件
    ExcelPath="C:\Program Files\Microsoft Office\Office"  'Office 所在的路径
    Shell ExcelPath + "\" + "excel.exe  " + ExcelFileName, vbMaximizedFocus
    打开Word同上
    Shell ExcelPath + "\" + "Word.exe  " + ExcelFileName, vbMaximizedFocus
      

  3.   

    shell "start a.doc"
    shell "start b.xls"
      

  4.   

     'VB控制EXCEL打开指定文件      Dim AppExl            As Excel.Application
        Dim WbkExl            As Excel.Workbook
        Dim strRepfile        As String
        Dim strTmpfilename    As String    Set AppExl = New Excel.Application
         Set WbkExl = AppExl.Workbooks.Open(strRepfile, True) '打开文件
         AppExl.Visible = False
         If Dir("C:\TEMP\") = "" Then MkDir "c:\temp"
         strTmpfilename = "C:\temp\tmp0001.xls"
         If Dir(strTmpfilename) <> "" Then Kill strTmpfilename  '删除文件
         WbkExl.SaveAs strTmpfilename
         WbkExl.Close
         Set WbkExl = AppExl.Workbooks.Open(strTmpfilename)
         AppExl.Sheets("Sheet1").Select
        ......
        ......
             WbkExl.Save
        WbkExl.Close
        Set WbkExl = AppExl.Workbooks.Open(strTmpfilename)
    '''打印报表
        AppExl.Sheets("Sheet1").Select
        AppExl.ActiveWindow.SelectedSheets.PrintOut Copies:=1,Collate:=True
        WbkExl.Close
        AppExl.Quit