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
Solved

names in capitals

Posted on 2003-11-04
7
179 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
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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 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…

829 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