Fields How do you split/concatenate strings

S

Simon Tonkin

I am using fields in my document such as date and author.
i.e. { DOCPROPERTY Author \* MERGEFORMAT }

I wish to split the author field which is currently "Joe
Bloggs" and create a text field that is an email i.e.
(e-mail address removed)

How do I concatenate "Joe" then "_" and then "Bloggs" in
lower case?

Or is this not possible and I need a custom first name and
last name?

Simon.
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Simon,

Dim mystring As String
mystring = "Joe Bloggs"
mystring = LCase(Left(mystring, InStr(mystring, " ") - 1) & "_" &
Mid(mystring, InStr(mystring, " ") + 1))
MsgBox mystring

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 
S

Simon Tonkin

I was hoping that it may be possible to do this without
vba code using a field formula. Is this possible?

Simon.
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Simon,

I don't think so.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

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