Dynamically created controls

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

    Dynamically created controls

    Hi everyone,

    I have actually been successful in creating controls
    onto forms on the fly. What I am wondering is if it
    is possible to generate VBA code for a particular control
    at the same time.

    For example, a combobox is created with all the properties
    added in code. Then, an event procedure (ie. ON CLICK) is
    subsequently generated for that control via code.

    I have been able to create a blank form with VBA included
    for non-existent controls that can later be pointed to. But,
    I'm wondering if it can be done programatically from scratch.

    Thanks for any suggestions. SAM
  • Duncan Macarthur

    #2
    Re: Dynamically created controls


    "SAM" <gavroche_01@ho tmail.com> wrote in message
    news:98a113b0.0 404182030.1bc0c 97f@posting.goo gle.com...[color=blue]
    > Hi everyone,
    >
    > I have actually been successful in creating controls
    > onto forms on the fly. What I am wondering is if it
    > is possible to generate VBA code for a particular control
    > at the same time.
    >
    > For example, a combobox is created with all the properties
    > added in code. Then, an event procedure (ie. ON CLICK) is
    > subsequently generated for that control via code.
    >
    > I have been able to create a blank form with VBA included
    > for non-existent controls that can later be pointed to. But,
    > I'm wondering if it can be done programatically from scratch.
    >[/color]

    Yes, look for help on the insertlines method.

    Regards,

    Duncan Macarthur


    Comment

    • Duncan Macarthur

      #3
      Re: Dynamically created controls


      "SAM" <gavroche_01@ho tmail.com> wrote in message
      news:98a113b0.0 404182030.1bc0c 97f@posting.goo gle.com...[color=blue]
      > Hi everyone,
      >
      > I have actually been successful in creating controls
      > onto forms on the fly. What I am wondering is if it
      > is possible to generate VBA code for a particular control
      > at the same time.
      >
      > For example, a combobox is created with all the properties
      > added in code. Then, an event procedure (ie. ON CLICK) is
      > subsequently generated for that control via code.
      >
      > I have been able to create a blank form with VBA included
      > for non-existent controls that can later be pointed to. But,
      > I'm wondering if it can be done programatically from scratch.
      >[/color]

      Yes, look for help on the insertlines method.

      Regards,

      Duncan Macarthur


      Comment

      • Hank Reed

        #4
        Re: Dynamically created controls

        Hello,
        What I do in that situation is to create the controls at
        design time, complete with the VBA code to handle events, but I set
        the visible property to false. Then, as I need them, I make them
        visible.

        Write me direct, if you need more help.
        Hank Reed

        Comment

        • Hank Reed

          #5
          Re: Dynamically created controls

          Hello,
          What I do in that situation is to create the controls at
          design time, complete with the VBA code to handle events, but I set
          the visible property to false. Then, as I need them, I make them
          visible.

          Write me direct, if you need more help.
          Hank Reed

          Comment

          Working...