0
我在工作表上有DatePicker控件。當我在工作表的嵌入代碼中時,可以訪問控件的值,如下所示:無法從DatePicker獲得價值
Public Sub showValue()
Debug.Print Me.DTPicker21.value
End Sub
我想從模塊中獲取值。代碼在這裏:
Sub getDate()
Dim obj As Object
Dim sht As Worksheet
Set sht = ThisWorkbook.Sheets("Tool interface")
For Each obj In sht.OLEObjects
If obj.Name = "DTPicker21" Then
Debug.Print obj.value
End If
Next
End Sub
當我運行這一點,obj.value
觸發此錯誤:
Object doesn't support this property or method
我檢查的屬性列表中使用this procedureobj
,並沒有value
財產。我怎樣才能得到在DatePicker中設置的日期值?