Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-16-2018, 01:49 AM
tommatwalker tommatwalker is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2018
Posts: 5
tommatwalker is on a distinguished road
Default Replace characters in mergefield

Hi all,



I'm sure this has been asked before but I can't find it on this fine forum!

I am new to using mergefields and I am hoping to do some manipulation on the data within one. I have a field that contains employee names i.e. "Firstname Lastname" and I know that the standard form for company email addresses is "firstname.lastname@companyname.co.uk".

My question is is there a way within mergefield if formulas to automatically format the name field to an email field i.e. replace the space with a "." and add the email url at the end?

Thanks in advance.

Regards

Tom
Reply With Quote
  #2  
Old 07-16-2018, 04:35 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,191
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

A mailmerge cannot perform a Find/Replace (i.e. to replace the space with a period); aside from that showstopper, it's quite possible to turn the string into a working email address.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 07-16-2018, 05:34 AM
tommatwalker tommatwalker is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2018
Posts: 5
tommatwalker is on a distinguished road
Default

Hi mate thanks for the info would that be done within VB?
Reply With Quote
  #4  
Old 07-16-2018, 04:17 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,191
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Sure, you can do lots of things with VBA, but then it ceases to be a mailmerge and you have to replicate your entire mailmerge logic etc. in the vba code.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 07-17-2018, 12:01 AM
tommatwalker tommatwalker is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2018
Posts: 5
tommatwalker is on a distinguished road
Default

Hi Pal,

Did you have a suggestion that wasn't VBA? Purely because I don't want to have to make the documents macro enabled if I don't have to.

Thanks

Tom
Reply With Quote
  #6  
Old 07-17-2018, 12:24 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,191
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Well, you did ask about a VB...

Assuming you can do your merge setup so it outputs:
Code:
firstname lastname@companyname.co.uk
you could then do a wildcard Find/Replace, where:
Find = (<[A-Za-z0-9]@>) (<[A-Za-z0-9]@>\@[A-Za-z0-9.]{1,})
Replace = \1.\2
to turn all those strings into:
Code:
firstname.lastname@companyname.co.uk
Even so, you wouldn't have clickable email addresses.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 07-17-2018, 12:30 AM
tommatwalker tommatwalker is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2018
Posts: 5
tommatwalker is on a distinguished road
Default

Yeah apologies for the confusion, thanks for that info. The email address does not need to be clickable just displayed so it looks like that would work!

Thanks

Tom
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace All -- inserting a space between two non-consistent characters knpaddac Word 1 01-30-2018 12:52 PM
Combining Characters in Find & Replace Surge Word 5 01-11-2017 03:43 PM
Replace characters in a string Anthon Excel Programming 1 11-03-2016 12:48 AM
Use wildcards to replace some characters mauuuuu5 Excel 2 12-12-2015 07:27 PM
Find and Replace some characters with Bullets kjxavier Word 1 01-02-2015 12:15 AM


All times are GMT -7. The time now is 02:04 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft