Shell ("c:\program files\microsoft office\office\excel.exe d:\ddd.xls")
如果用这个语句打开的话,要自己手动输入密码的.请问有什么方法把已知的密码加到语句中呢?

解决方案 »

  1.   

    这样不好,如果不是安装在C盘,或版本不一样就不行了,还是用EXCEL对象吧
    set xlApp=createobject("Excel.Application")
    xlApp.workbooks.open filename:="d:\ddd.xls",password:="xxxxxx"
    xlApp.visible=true
      

  2.   

    Private Sub Command1_Click()
    Dim i As Integer
    Set xlApp = CreateObject("Excel.Application")
    On Error GoTo 10: '出错处理
    For i = 0 To 9
        xlApp.workbooks.Open FileName:="d:\ddd.xls", Password:=i '当i>1时出错处理的语句就不管用了,请问为什么呢?
        xlApp.Visible = True
        End
    10:
        Err = 0 '出错处理
    Next i
    End Sub当i>1时出错处理的语句就不管用了,请问为什么呢?
      

  3.   

    Private Sub Command1_Click()
    Dim i As Integer
    Set xlApp = CreateObject("Excel.Application")
    On Error GoTo 10: '出错处理
    For i = 0 To 9
        xlApp.workbooks.Open FileName:="d:\ddd.xls", Password:=i '当i>1时出错处理的语句就不管用了,请问为什么呢?
        xlApp.Visible = True
        End
        exit sub
    10:
        if Err.number <> 0 '出错处理
               debug.print "出错!!!!"
        end if 
    Next i
    End Sub
      

  4.   

    我有一个EXCEL 的文件你们可以帮我打开工吗?