Dim xyzWkB As Excel.workbook
Set xyzWkB = setGetxyzObj(reportFile.Text)
populateListCombo (xyzWkB)
该功能定义如下:
Public Function populateListCombo(activeWkB As Excel.workbook)
......
......
End Function
但在致电时populateListCombo
执行时我发现错误"对象不支持此属性"
此处setGetxyzObj
的定义如下:
Public Function setGetxyzObj(Optional userInput As String) As Excel.workbook
Static xyz As New Excel.Application
Static xyzWkB As Excel.workbook
Set xyz = New Excel.Application
If Not (userInput = "") Then
Set xyzWkB = xyz.Workbooks.Open(userInput)
End If
Set setGetxyzObj = xyzWkB
End Function
我也尝试使用populateListCombo (setGetxyzObj())
,但仍然遇到同样的错误。