Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Converting the first character of a name to a capital?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Guus van Waardenburg - 31 May 2006 11:44 GMT
Good day all,

I have a problem of which I hop you can help me out with.

I have a userform to put in personal data of a client. The data my collegues
put in will be ending up in al letter. Now, in one ocasion Someone's name is
for example Guus van Waardenburg. When you write the name with the first name
'van' needs to be written in lower case, when you only write the last name,
'van' needs to be starting with a capital like this: 'Van Waardenburg', how
can I put this in my code?

My Code:

   Selection.GoTo What:=wdGoToBookmark, Name:="Aanhef"
   If TextBox4.Value = "" Then
       If Not TextBox3.Value = "" Then
           Selection.TypeText TextBox10 & " " & TextBox3 & " " & TextBox1 &
","
       Else
           Selection.TypeText TextBox10 & " " & TextBox1 & ","
       End If
   ElseIf Not TextBox17.Value = "" Then
       Selection.TypeText TextBox10 & " " & TextBox17 & " " & TextBox4 & ","
   Else
       Selection.TypeText TextBox10 & " " & TextBox4 & ","
   End If

Can someone help? (TextBox17 = van)
Dave Lett - 31 May 2006 14:14 GMT
Hi,

I'm not sure what your conditions are in context of your overall routine, so
maybe this little snippet will get you going in the right direction (then
set bCondition to False and run it again):

Dim sName As String
Dim bCondition As Boolean
sName = "van"

bCondition = True

If bCondition Then
   sName = StrConv(sName, vbProperCase)
Else
   sName = sName
End If

MsgBox sName

HTH,
Dave

> Good day all,
>
[quoted text clipped - 31 lines]
>
> Can someone help? (TextBox17 = van)

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.