+ Reply to Thread
Results 1 to 4 of 4

Building object reference

  1. #1
    zsola
    Guest

    Building object reference

    Hi Experts,

    My question is, how can I refer to objects(eg. textboxes)
    in a for..next cycle, for instance something like this:

    for i=1 to 10

    (textbox & i).text=Cstr(i)
    'where (textbox & i) is for representing
    'textbox1...textbox10

    next i

    Thanks in advance:
    Zsola

  2. #2
    Tom Ogilvy
    Guest

    Re: Building object reference

    textboxes from the control toolbox toolbar
    on a userform

    for i = 1 to 10
    userform1.Controls("Textbox" & i).Text = ""
    Next

    on a Worksheet
    for i = 1 to 10
    activesheet.OleObjects("TextBox" & i).Object.Text = ""
    Next


    Textboxes from the drawing toolbar
    for i = 1 to 10
    Activesheet.Textboxes("Textbox" & i).Value = ""
    Next
    --
    Regards,
    Tom Ogilvy

    "zsola" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Experts,
    >
    > My question is, how can I refer to objects(eg. textboxes)
    > in a for..next cycle, for instance something like this:
    >
    > for i=1 to 10
    >
    > (textbox & i).text=Cstr(i)
    > 'where (textbox & i) is for representing
    > 'textbox1...textbox10
    >
    > next i
    >
    > Thanks in advance:
    > Zsola




  3. #3
    Bob Phillips
    Guest

    Re: Building object reference

    For i = 1 to 10
    Me.Controls("TextBox" & i).Text = i
    Next i

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "zsola" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Experts,
    >
    > My question is, how can I refer to objects(eg. textboxes)
    > in a for..next cycle, for instance something like this:
    >
    > for i=1 to 10
    >
    > (textbox & i).text=Cstr(i)
    > 'where (textbox & i) is for representing
    > 'textbox1...textbox10
    >
    > next i
    >
    > Thanks in advance:
    > Zsola




  4. #4
    zsola
    Guest

    Re: Building object reference

    Thanks. this is the solution.
    >-----Original Message-----
    >textboxes from the control toolbox toolbar
    > on a userform
    >
    > for i = 1 to 10
    > userform1.Controls("Textbox" & i).Text = ""
    > Next
    >
    > on a Worksheet
    > for i = 1 to 10
    > activesheet.OleObjects("TextBox" & i).Object.Text

    = ""
    > Next
    >
    >
    >Textboxes from the drawing toolbar
    > for i = 1 to 10
    > Activesheet.Textboxes("Textbox" & i).Value = ""
    > Next
    >--
    >Regards,
    >Tom Ogilvy
    >
    >"zsola" <[email protected]> wrote in message
    >news:[email protected]...
    >> Hi Experts,
    >>
    >> My question is, how can I refer to objects(eg.

    textboxes)
    >> in a for..next cycle, for instance something like this:
    >>
    >> for i=1 to 10
    >>
    >> (textbox & i).text=Cstr(i)
    >> 'where (textbox & i) is for representing
    >> 'textbox1...textbox10
    >>
    >> next i
    >>
    >> Thanks in advance:
    >> Zsola

    >
    >
    >.
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1