Determining whether an object is a member of a collection in VBA

前端 未结 15 1841
自闭症患者
自闭症患者 2020-11-27 05:35

How do I determine whether an object is a member of a collection in VBA?

Specifically, I need to find out whether a table definition is a member of the TableDe

15条回答
  •  误落风尘
    2020-11-27 06:18

    Your best bet is to iterate over the members of the collection and see if any match what you are looking for. Trust me I have had to do this many times.

    The second solution (which is much worse) is to catch the "Item not in collection" error and then set a flag to say the item does not exist.

提交回复
热议问题