Results 1 to 16 of 16

trying to change a txtbx in module

Threaded View

  1. #1
    Registered User
    Join Date
    09-24-2003
    Posts
    62

    trying to change a txtbx in module

    I have a project with many forms and textboxes. I am trying to create a module that will add a "." (Chr45) in the value.

    this is the code on the userform. the textbox name changes throughout the project

    Private Sub TextBox4_Exit(ByVal Cancel As msforms.ReturnBoolean)
    
    Run TxtBx_Change
    
    end sub
    this is what i have in the module. I suspect it has to do with knowing the actual name of the textbox?
    the code below is not working, could anyone help?

    Private Sub TxtBx_Change()
    Dim CtlTxt As TextBox
    Dim Str1 As String
    Dim Str2 As String
    
    Str1 = Mid(CtlTxt.Value, 1, 2)
    Str2 = Mid(CtlTxt.Value, 3, 4)
    
    If CtlTxt.TextLength = 4 Then
        CtlTxt.Value = Str1 & Chr(45) & Str2
    End If
    
    End Sub
    it is a basic code i am just starting to work with. I will be expanding the code as soon as i figure out this simple task
    Last edited by Zygoid; 12-30-2008 at 06:28 AM.

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