Solved

names in capitals

Posted on 2003-11-04
7
181 Views
Last Modified: 2010-05-03
i nedd the first letter of every word to be a cap


col_jack_oneal
0
Comment
Question by:pastiesrus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
7 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9679446
use the StrConv fuinction with the Parameter vbProperCase:

Dim strName as String
strName = "THE FULL NAME"
strName = strConv(strName,vbProperCase)

strName = "The Full Name"

AW
0
 

Expert Comment

by:joyful88
ID: 9683112
dim strWord, strLeft, strRight as String

strWord = txtWord.Text
strLeft = UCase$(Left$(strWord,1))
strRight=Mid$(strWord,2,len(strWord)-1)

strWord = strLeft & strRight

-->> you may need to play around with the starting point of the Mid$ function.

0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 50 total points
ID: 9684000
joyful88:

this line:

dim strWord, strLeft, strRight as String

does NOT do what you think it does.  It does NOT dim all three variables as string, only the strRight is Dimmed as String, the other two are VARIANTS.

and your code does not answer the question :

" nedd the first letter of EVERY word to be a cap" (my emphasis)

AW
0
 
LVL 1

Expert Comment

by:Lycaon
ID: 9898591
If you want col_jack_oneal to come out like Col_Jack_Oneal then this function would work:

Private Function Capitalize(sStr As String) As String
Dim TmpStr() As String, x As Integer

TmpStr = Split(sStr, "_")

For x = LBound(TmpStr) To UBound(TmpStr)
Capitalize = Capitalize & StrConv (TmpStr(x), vbProperCase) & "_" ' Replace _ with any other character you want.  Use a space to turn col_jack_oneal into Col Jack Oneal

End Function
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question