Private Sub Button11_Click()
Dim oXL4 As New Excel.Application
Dim oWB4 As Excel.Workbook
Dim oSheet4 As Excel.Worksheet
If ComboBox10.Text = "abc" Then
oWB4 = oXL4.Workbooks.Open("D:\blah\blah\Def.xlsx")
oSheet4 = oWB4.Worksheets(2).Activate
oXL4.Visible = True
oXL4.UserControl = True
End If
End Sub
错误/异常:
System.InvalidCastException 未处理消息=无法将“System.Boolean”类型的对象转换为“Microsoft.Office.Interop.Excel.Worksheet”类型。
这段代码有什么问题?
提前致谢。