J
Joshua
I'm trying to work my way through this and would appreciate any help I
can receive
I will give you examples to hopefully show you what I want. I'm trying
to prevent users from typing ALL caps.
If a user types the following text "THE LAZY BROWN FOX JUMPED SOME SILLY
FENCE" they get different results based on settings in box.
What I would like to see is "The lazy brown fox jumped some silly fence"
with Uppercase - "THE LAZY BROWN FOX JUMPED SOME SILLY FENCE"
with Lowercase - "the lazy brown fox jumped some silly fence"
with First capital - "THE LAZY BROWN FOX JUMPED SOME SILLY FENCE"
with Title Case - "The Lazy Brown Fox Jumped Some Silly Fence"
I found some code using google:
lPosOld = 1
lPos = 1
Set ffld = ActiveDocument.FormFields("Name")
szFieldContent = ffld.Result
Do
lPos = InStr(lPos, szFieldContent, ". ") + 1
If lPos > 1 Then
szNewContent = szNewContent & _
Mid(szFieldContent, lPosOld, lPos) & _
UCase(Mid(szFieldContent, lPos+1, 1)
lPos = lPos + 1
lPosOld = lPos
End if
Loop While lPos > 1
ffld.Result = szNewContent
But it frowns at the section:
szNewContent = szNewContent & _
Mid(szFieldContent, lPosOld, lPos) & _
UCase(Mid(szFieldContent, lPos+1, 1)
I think I understand the jist of the code.. ipos sets current location
in Field, iposold sets previous location, it goes through each character
until it finds a period and then goes one past the space of the period
and changes the case.
I'm not familiar enough with VBA to know if I need to define
sznewcontent beforehand or how to even do that properly
If anyone could assist with this I would greatly appreciate it.
Thanks,
Joshua
can receive
I will give you examples to hopefully show you what I want. I'm trying
to prevent users from typing ALL caps.
If a user types the following text "THE LAZY BROWN FOX JUMPED SOME SILLY
FENCE" they get different results based on settings in box.
What I would like to see is "The lazy brown fox jumped some silly fence"
with Uppercase - "THE LAZY BROWN FOX JUMPED SOME SILLY FENCE"
with Lowercase - "the lazy brown fox jumped some silly fence"
with First capital - "THE LAZY BROWN FOX JUMPED SOME SILLY FENCE"
with Title Case - "The Lazy Brown Fox Jumped Some Silly Fence"
I found some code using google:
lPosOld = 1
lPos = 1
Set ffld = ActiveDocument.FormFields("Name")
szFieldContent = ffld.Result
Do
lPos = InStr(lPos, szFieldContent, ". ") + 1
If lPos > 1 Then
szNewContent = szNewContent & _
Mid(szFieldContent, lPosOld, lPos) & _
UCase(Mid(szFieldContent, lPos+1, 1)
lPos = lPos + 1
lPosOld = lPos
End if
Loop While lPos > 1
ffld.Result = szNewContent
But it frowns at the section:
szNewContent = szNewContent & _
Mid(szFieldContent, lPosOld, lPos) & _
UCase(Mid(szFieldContent, lPos+1, 1)
I think I understand the jist of the code.. ipos sets current location
in Field, iposold sets previous location, it goes through each character
until it finds a period and then goes one past the space of the period
and changes the case.
I'm not familiar enough with VBA to know if I need to define
sznewcontent beforehand or how to even do that properly
If anyone could assist with this I would greatly appreciate it.
Thanks,
Joshua