Solved

names in capitals

Posted on 2003-11-04
7
176 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
  • 2
7 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now