|
Dim a
Public Function CheckObjectDesription(parent, descr)
Dim oDesc
' Create description object
Set oDesc = Description.Create()
arProps = Split(descr, ",")
For i = 0 To UBound(arProps)
arProp = Split(arProps(i), ":=")
If UBound(arProp) = 1 Then
PropName = Trim(arProp(0))
PropValue = arProp(1)
oDesc(PropName).Value = PropValue
End If
Next
' Get all child objects with the given description
Set children = parent.ChildObjects(oDesc)
If children.Count = 1 Then
CheckObjectDesription = "Object Unique"
msgbox CheckObjectDesription
ElseIf children.Count = 0 Then
CheckObjectDesription = "Object Not Found"
msgbox CheckObjectDesription
Else
CheckObjectDesription = "Object Not Unique"
msgbox CheckObjectDesription
End If
End Function
CheckObjectDesription a,"I,love,you"
大家能帮看看这个代码,我出错了,有提示“缺少对象: 'parent'
Line (17): "Set children = parent.ChildObjects(oDesc)". “
,不能通过? |
|