我有一张表格叫做Form1, 在Form1,我有以下代码
Dim details As clsDetails
Set details = getDetials(1) This fails. It doesn t assign a value.
Get Details 函数在一个单独的模块中声明如下:
Public Function getDetials(detailNumber As Integer) As clsDetails
Dim details As clsDetails
Select Case detailNumber
Case "1"
Debug.Print "Inside case1"
Set details = getDetail1()
Debug.Print details.comment This prints correctly.
End Select
Set getDetails = details
End Function
然而,当我执行上述代码时,不知何故,Form1中的细节变量没有被设置,即使调用“获取细节”功能并正确打印其中的细节。 如何纠正这一点?