?
Solved

names in capitals

Posted on 2003-11-04
7
Medium Priority
?
183 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

770 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