Check last character

K

Kevin R

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?
 
G

Greg Maxey

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.
 
J

Jezebel

Greg has given you the gist of the method. But I query the correctness. The
possessive of Jones is Jones's not Jones'
 
R

Russ

I was taught to do this way, which I pulled from a grammar page on the web.
--------------------------------------
Singular possessive
The possessive form of a singular noun is an apostrophe followed by the
letter "s."

Kramer's hair
Daphne's patience
the car's engine

Words ending with s, z or x generally omit the "s."

Dr. Seuss' sense of humor
---------------------------------------
 
R

Russ

Kevin,
How do I check the userform textbox beforehand? That would be even better.
You test it with the same type of 'If...Else...End If' clause that Greg
showed, but in the appropriate click event subroutine in your userform. You
may want to keep the original unchanged name in one variable and within the
aforementioned clause create another variable for the possessive version of
the name to put in the docVariable you mentioned.
 
J

Jezebel

I'd been interested in your source: Google throws up a heap of blogs and
tutorials on this topic, very few of which -- and none of the authorititave
ones -- agree with you. Even the execrable Strunk and White prefer 's for
possessives of words ending in s. Perhaps you're confusing the issue with
the possessive of plurals (where s' is indeed correct)?
 
R

Russ

Jezebel,
Here's the source I quoted:
http://www.meredith.edu/grammar/plural.htm#Singular p

"For proper names that end in s, style guides differ. Newspaper style guides
advocate adding only an apostrophe (Socrates' thoughts), while some standard
grammar guides state that all names other than those of biblical or
classical derivation require the addition of 's (thus, Socrates' thoughts,
Moses' footsteps, Orson Welles's films)."
That was quoted from:
http://www.editpros.com/news1101.html
 
J

Jezebel

Rather confirms my point than yours, I think.

For what it's worth, you'll also find a heap of sites and blogs on the 'the
way I was taught' syndrome.)
 
D

doctorjones_md

Russ,

I tend to agree with Jezebel on her interpretation of the rules (listed at
the site you offered) -- unless you're dealing with some biblical persona,
the Jones's example holds true -- I've used it all my life! ;)

HTH end the volley of opinions ;)
==========================
 
R

Russ

Yes, I have seen enough to change my usage to the more formal style. It
stuck in my mind because I went to a Catholic school and had a Religion
class every year taught by the Nuns. :-(
Therefore, I became too familiar with seeing the biblical persona usage and
didn't think there was a distinction.

P.S. Speaking of biblical persona, Jezebel might not be Jezebel's real name
or implied sex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top