![]() |
excel isObject or collection exists
how is the syntex in vba excel to check: if object exists, or is
object in collection exists. I tried this code in vba excel : if (oElement.Attributes("backGroundColor")) then .... do something but got error. in VBA code there are some common object instance,checking like: isObject(obj)=0 or: obj=null or: obj is nothing or empty none of above works ?? only something like on error resume next ?? (not very common) why excel VBA is different from other VBA like MS-Access ? el |
excel isObject or collection exists
Hi
There are probably neater ways of doing it but I tend to use err.clear On error Resume next Set ObjectName = myobject On Error goto 0 If err.number = 0 then 'myobject exists and I can use it End if err exists while excel is open so must be cleared first. regards Paul On Jan 24, 8:20*am, ell wrote: how is the syntex in vba excel to check: if object exists, or is object in collection exists. I tried this code in vba excel : if (oElement.Attributes("backGroundColor")) then ... do something but got error. in VBA code there are some common object instance,checking like: isObject(obj)=0 or: obj=null or: *obj is nothing or empty none of above works ?? only something like on error resume next ?? (not very common) why excel VBA is different from other VBA like MS-Access ? el |
All times are GMT +1. The time now is 01:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com