打开关闭工作簿等
1 Sub 打开工作簿() 2 Dim sFilePath As String 3 sFilePath = "D:A.xls" 4 Dim oWB As Workbook 5 Set oWB = Excel.Workbooks.Open(sFilePath, ReadOnly:=False, writerespassword:="123") 6 delay (5) 7 If Not oWB.ReadOnly Then 8 9 oWB.Close SaveChanges:=True 10 Else 11 MsgBox "文件只读,无法修改!" 12 oWB.Close SaveChanges:=False 13 End If 14 Set oWB = Nothing 15 End Sub