vba - How to check if a particular object is a collection or a string? -


specifically, i'm working itemproperties in context of outlook 2010. want info out of info stored in itemproperties of mailitem. this:

dim folderitems object set folderitems = folder.items set thisitem = folderitems(index).itemproperties p = 1 thisitem.count     debug.print thisitem.item(p).name & " = " & thisitem.item(p).value      '= stuff involving thisitem.item(p) etc next 

the problem works fine long value straightforward string, gives error when comes things "actions", value collection/array in (have .count property), or not straightup string value. i'm trying think of way catch kinds of value, handle them differently in code, i'm not able find one.

any help?

use typeof()-method

example:

if typeof(thisitem.item(p)) string     msgbox "string" end if 

to check wheter object supports property:

if iserror(thisitem.item(p).value     msgbox "item doesn't support value property" else     msgbox "item has value property" end if 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -