![]() |
How to check if an object has a certain property?
If I have a procedure that takes as input an object, how do I
programmatically check to see if that object has a height property? Function CheckForHeightProperty(InputObject as Object) ?? How do I check to see what properties this object has? Is there any way to enmurate them programmatically?? End Function |
How to check if an object has a certain property?
Hi
I'd do it the brutal way; ask for it and check for errors: Function HasHeight(InputObject As Object) As Boolean Dim D As Double On Error Resume Next D = InputObject.Height If Err.Number = 0 Then HasHeight = True End Function Sub test() MsgBox HasHeight(ActiveSheet.Rows(4)) MsgBox HasHeight(UserForm1) MsgBox HasHeight(Application.AnswerWizard) End Sub HTH. Best wishes Harald "J" skrev i melding ... If I have a procedure that takes as input an object, how do I programmatically check to see if that object has a height property? Function CheckForHeightProperty(InputObject as Object) ?? How do I check to see what properties this object has? Is there any way to enmurate them programmatically?? End Function |
All times are GMT +1. The time now is 01:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com