+ Reply to Thread
Results 1 to 5 of 5

Textbox Problem

  1. #1
    Registered User
    Join Date
    02-15-2006
    Posts
    93

    Textbox Problem

    Good afternoon everyone,

    Quick question. I have a userform that has several textboxes. When I am in Visual Basic and using the properties window, I can change the SpecialEffect property. i.e. sunken, flat, etc.

    What I am wondering is can I change this property using VBA for the textbox?

    Any ideas are appreciated.
    Thanks,
    dw

  2. #2
    Bob Phillips
    Guest

    Re: Textbox Problem

    With Me.TextBox1
    .SpecialEffect = fmSpecialEffectSunken
    End With


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "toocold" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Good afternoon everyone,
    >
    > Quick question. I have a userform that has several textboxes. When I
    > am in Visual Basic and using the properties window, I can change the
    > SpecialEffect property. i.e. sunken, flat, etc.
    >
    > What I am wondering is can I change this property using VBA for the
    > textbox?
    >
    > Any ideas are appreciated.
    > Thanks,
    > dw
    >
    >
    > --
    > toocold
    > ------------------------------------------------------------------------
    > toocold's Profile:

    http://www.excelforum.com/member.php...o&userid=31608
    > View this thread: http://www.excelforum.com/showthread...hreadid=532998
    >




  3. #3
    Registered User
    Join Date
    02-15-2006
    Posts
    93
    Thanks Bob, exactly what I was looking for.

    One more question.

    I have a series of textboxes. Textbox1 through Textbox12. For each textbox, I want to test something to see if it is true. I am going to use a if then statement. But what I was wondering is can a person somehow identify the textbox using a variable. I don't want to have the same code repeated for each textbox.

    ie. Could I somehow do something like

    Dim xcount as integer

    xcount = 12

    Do while xcount > 0

    'unspecified code if statement
    textbox(xcount).value = something.

    loop

    Just curious. This would help me simplify the work greatly. Any ideas?
    Cheers,
    dw

  4. #4
    Bob Phillips
    Guest

    Re: Textbox Problem

    Dim ctl As Control
    For Each ctl In Me.Controls
    If TypeName(ctl) = "TextBox" Then
    MsgBox ctl.Name
    End If
    Next ctl

    is one way of getting at all textboxes in a loop

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "toocold" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks Bob, exactly what I was looking for.
    >
    > One more question.
    >
    > I have a series of textboxes. Textbox1 through Textbox12. For each
    > textbox, I want to test something to see if it is true. I am going to
    > use a if then statement. But what I was wondering is can a person
    > somehow identify the textbox using a variable. I don't want to have
    > the same code repeated for each textbox.
    >
    > ie. Could I somehow do something like
    >
    > Dim xcount as integer
    >
    > xcount = 12
    >
    > Do while xcount > 0
    >
    > 'unspecified code if statement
    > textbox(xcount).value = something.
    >
    > loop
    >
    > Just curious. This would help me simplify the work greatly. Any
    > ideas?
    > Cheers,
    > dw
    >
    >
    > --
    > toocold
    > ------------------------------------------------------------------------
    > toocold's Profile:

    http://www.excelforum.com/member.php...o&userid=31608
    > View this thread: http://www.excelforum.com/showthread...hreadid=532998
    >




  5. #5
    Registered User
    Join Date
    02-15-2006
    Posts
    93
    Thanks Bob, I will give that a shot.
    Cheers,
    dw

+ 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