Re: Check last character
- From: "Greg Maxey" <gmaxey@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 22 Oct 2006 23:14:11 -0400
I am assuming that you are checking the last character of the docVariable
value. Something like this:
Sub Test()
Dim strName As String
ActiveDocument.Variables("EElName").Value = "Miller" 'added for testing
strName = ActiveDocument.Variables("EElName").Value
If Right(strName, 1) = "s" Then
strName = strName & "'"
Else
strName = strName & "'s"
End If
MsgBox strName
End Sub
You could just as easily check the Userform textbox for this condition and
make the change before writing its result to the docvariable.
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
Kevin R wrote:
I have a docvariable - { DOCVARIABLE "EELName" } - that pulls an
employees last name from a user form. I need to be able to check the
last character of that name to see if it is an "s" or not. If so,
then I will need to add just an apostrophe. If it is not an "s" then
I will need to add an apostrophe followed by s, ex: 's. Any ideas?
.
- Prev by Date: Re: Finding Word Version
- Next by Date: Re: Counting-Macro for non-empty rows in a column
- Previous by thread: Finding Word Version
- Next by thread: Re: Check last character
- Index(es):
Relevant Pages
|