Results 1 to 7 of 7

Thread: Converting textbox to uppercase

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Converting textbox to uppercase

    How do you convert text in the Keypress event to uppercase everytime you enter a character? I know how to do it in straight VB but not sure in VBA.

    Thanks,

    Blake

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Converting textbox to uppercase

    UCase()
    Tengo mas preguntas que contestas

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: Converting textbox to uppercase

    I just used the same method that you use in VB.

    Text1.Text = Asc(Ucase(Chr(Keyascii)))

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Converting textbox to uppercase

    text1.text = ucase(text1.text)

    pete

  5. #5
    Addicted Member
    Join Date
    Mar 2005
    Posts
    158

    Re: Converting textbox to uppercase

    VB Code:
    1. Private Sub Button1_KeyPress(KeyAscii As Integer)
    2.     KeyAscii = Asc(UCase(Chr(KeyAscii)))
    3. End Sub
    if u felt my post make u happy ,
    then u could make me happy too by rating my post

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: Converting textbox to uppercase

    Dev,

    Thanks for the code but that's what I always use for straight VB, however, I did retry it in VBA and it did work. Don't know why it didn't work the first time.
    But thanks for the 2 cents.

    Blessings,

    Blake

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Converting textbox to uppercase

    Blake, most of VB6's basic functions, methods, and coding syntax is the same as VBA.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width