Dim itemlist1 As Workbook
on error resume next
Set itemlist1 = Workbooks.Open(ThisWorkbook.Path & Application.PathSeparator & "east_Iitemlist1.xls", ReadOnly:=True
if itemlist1 is nothing then msgbox "工作簿打开失败":exit sub
我这样写可以吗?
Dim itemlist1 As Workbook
Set itemlist1 = Workbooks.Open(ThisWorkbook.Path & Application.PathSeparator & "east_Iitemlist1.xls"), ReadOnly:=True
Dim itemlist1 As Workbook
on error resume next
Set itemlist1 = Workbooks.Open(ThisWorkbook.Path & Application.PathSeparator & "east_Iitemlist1.xls", ReadOnly:=True
if itemlist1 is nothing then msgbox "工作簿打开失败":exit sub
我怎么写对吗?如果对的话在什么情况下会运行到"MsgBox "工作簿打开失败":"这句话
Dim itemlist1 As Workbook
On Error Resume Next
Set itemlist1 = Workbooks.Open(ThisWorkbook.Path & Application.PathSeparator & "east_Iitemlist.xls", ReadOnly:=True)
If itemlist1 Is Nothing Then
MsgBox "工作簿打开失败":
Exit Sub
End If