VBA class element names

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roy

    #1

    VBA class element names

    Is there a way to run through the members of a class in VBA the way one
    would run through the elements of an array? I want to store the member
    name by referencing, say, clsXYZ.<member> .

  • Tom van Stiphout

    #2
    Re: VBA class element names

    On 23 Sep 2006 20:08:18 -0700, "Roy" <royaaron1@gmai l.comwrote:

    Same question as a few hours ago?

    Obviously this is possible, because Intellisense and the Object
    Browser do just that.
    However, it takes a non-trivial understanding of COM to be able to
    pull this off. Happy studying.

    -Tom.

    >Is there a way to run through the members of a class in VBA the way one
    >would run through the elements of an array? I want to store the member
    >name by referencing, say, clsXYZ.<member> .

    Comment

    • Roy

      #3
      Re: VBA class element names

      Not the same question, actually. it's the actual question I meant to
      ask.
      And I want to store the member name in a variable from with a do loop.
      If you know the answer why not just tell me?

      Tom van Stiphout wrote:
      On 23 Sep 2006 20:08:18 -0700, "Roy" <royaaron1@gmai l.comwrote:
      >
      Same question as a few hours ago?
      >
      Obviously this is possible, because Intellisense and the Object
      Browser do just that.
      However, it takes a non-trivial understanding of COM to be able to
      pull this off. Happy studying.
      >
      -Tom.
      >
      >
      Is there a way to run through the members of a class in VBA the way one
      would run through the elements of an array? I want to store the member
      name by referencing, say, clsXYZ.<member> .

      Comment

      • Granny Spitz via AccessMonster.com

        #4
        Re: VBA class element names

        Roy wrote:
        If you know the answer why not just tell me?
        Pardon my butting in, but when Tom says, "it takes a non-trivial
        understanding of COM to be able to pull this off," he means it's a lot more
        involved than his writing two or three hundred lines of code for you. Your
        question is akin to "just tell me how to make money in the stock market." An
        answer of "buy low, sell high" would be technically correct, but it would be
        woefully inadequate. For that matter, *any* newsgroup posting would be
        inadequate. The investor must study a whole hoard of financial concepts and
        techniques, understand them, and then get some hands-on experience using
        those techniques if he doesn't want to rely on luck for his financial success.


        Likewise, you'll need to learn and understand the Component Object Model in
        order to use its methods to iterate through a COM object's class members in a
        library. If someone else wrote the class, then the members will have to be
        exposed (something that isn't always true) in order for you to iterate
        through those members. If you write the class yourself, then you'll probably
        need to learn C++ (if you don't know it already) to write the library,
        because the most useful examples are written in this programming language.

        --
        Message posted via http://www.accessmonster.com

        Comment

        • David W. Fenton

          #5
          Re: VBA class element names

          "Roy" <royaaron1@gmai l.comwrote in
          news:1159101436 .485959.325930@ e3g2000cwe.goog legroups.com:
          Not the same question, actually. it's the actual question I meant
          to ask.
          And I want to store the member name in a variable from with a do
          loop. If you know the answer why not just tell me?
          I've used an array (can't make it public in a class) that is
          populated in the prpperty LET statements. But there is no easy way
          to treat the members of a class module as a collection. Since I only
          needed to use the properties internally, and because not all the
          properties were needed, this worked out great for my purposes.

          --
          David W. Fenton http://www.dfenton.com/
          usenet at dfenton dot com http://www.dfenton.com/DFA/

          Comment

          Working...