Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 3 of 3

Thread: Proper Case Textbox Text In Multiple Textboxes

  1. #1
    Join Date
    1st May 2004
    Location
    Austin, Texas
    Posts
    446

    Proper Case Textbox Text In Multiple Textboxes

    Greetings,

    A while back someone showed me how to force Proper formatting onto the contents of a UserForm TextBox with:
    VB:
    TextBox1.Text = Application.Proper(TextBox1.Text) 
    
    
    This works with one TextBox.

    When I tried to apply this to multiple TextBoxes with:
    VB:
    Sub FormatAll(iArg As Integer) 
         
        Select Case iArg 
        Case 1, 5, 6, 7, 9, 11, 18 'Proper Formatting
            Me.Controls("TB" & iArg & ".Text") = Application.Proper(Me.Controls("TB" & iArg & ".Text")) 
        Case 2 
            .... 
        End Select 
    End Sub 
    
    
    I keep getting an error telling me that it can not find Me.Controls("TB" & iArg), which with iArg = 1 should be TB1 which is a valiid control.

    Can anyone see why debug can't see TB1 and what I can do to fix this code?

    Any help is appreciated.

    -Minitman

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,709

    Re: Proper Textbox Formatting With Multiple Textboxes

    should be TB1 which is a valiid control
    Yes, but you have "TB1.Text". Lose the & ".Text" and use the StrConv Function


    VB:
    Sub FormatAll(iArg As Integer) 
         
        Select Case iArg 
        Case 1, 5, 6, 7, 9, 11, 18 'Proper Formatting
            Me.Controls("TB" & iArg) = StrConv(Me.Controls("TB" & iArg),vbProperCase) 
        Case 2 
            .... 
        End Select 
    End Sub 
    
    

  3. #3
    Join Date
    1st May 2004
    Location
    Austin, Texas
    Posts
    446

    Re: Proper Case Textbox Text In Multiple Textboxes

    Thanks Dave,

    That did the job.

    It's amazing how the lack of one little bit of information can ruin the whole project.

    I did not know .Text would cause so much of a problem.

    Thank you for the assistance. It is greatly appreciated.

    -Minitman

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Proper Case Mac, Mc Names In TextBox
    By QuizGeezer in forum EXCEL HELP
    Replies: 4
    Last Post: December 17th, 2008, 06:48
  2. Proper Case Text In Message Box (MsgBox)
    By Darslg in forum EXCEL HELP
    Replies: 2
    Last Post: May 8th, 2008, 19:24
  3. Proper Case Text By Condition
    By mumphis in forum EXCEL HELP
    Replies: 12
    Last Post: October 22nd, 2007, 06:33
  4. Automatically Force Text to Upper/Proper Case
    By Dave Hawley in forum Excel FAQ
    Replies: 0
    Last Post: September 21st, 2005, 16:36
  5. Change Text to Upper Case or Proper Case
    By Raina in forum Excel FAQ
    Replies: 0
    Last Post: September 20th, 2005, 12:31

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
  •  
porno