下面的代码是用打开带有密码的excel的.Dim oExcel As Excel.Application
Dim oBook As Excel.Workbook
Dim i As Long
      
    Set oExcel = CreateObject("Excel.Application")
   
    If chkHavePassword.Value Then
        sOpenUser = Trim(txtUser.Text)
        sRPassword = Trim(txtReadPassword.Text)
        sWPassword = Trim(txtWritePassword.Text)
        Set oBook = oExcel.Workbooks.Open(sFullFileName, , , , sRPassword, sWPassword)
    Else
        Set oBook = oExcel.Workbooks.Open(sFullFileName)
    End If
   
   
   
    For i = 1 To oBook.Sheets.Count
        lstSheet.AddItem oBook.Sheets.Item(i).Name
    Next
    If lstSheet.ListCount > 0 Then lstSheet.ListIndex = 0
    
    oBook.Close
    
    oExcel.Quit