Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2018, 01:49 AM
tommatwalker tommatwalker is offline Replace characters in mergefield Windows 10 Replace characters in mergefield Office 2016
Novice
Replace characters in mergefield
 
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 Replace characters in mergefield Windows 7 64bit Replace characters in mergefield Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
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
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-16-2018, 05:34 AM
tommatwalker tommatwalker is offline Replace characters in mergefield Windows 10 Replace characters in mergefield Office 2016
Novice
Replace characters in mergefield
 
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 Replace characters in mergefield Windows 7 64bit Replace characters in mergefield Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
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
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 07-17-2018, 12:01 AM
tommatwalker tommatwalker is offline Replace characters in mergefield Windows 10 Replace characters in mergefield Office 2016
Novice
Replace characters in mergefield
 
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 Replace characters in mergefield Windows 7 64bit Replace characters in mergefield Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
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
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 07-17-2018, 12:30 AM
tommatwalker tommatwalker is offline Replace characters in mergefield Windows 10 Replace characters in mergefield Office 2016
Novice
Replace characters in mergefield
 
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 characters in mergefield Combining Characters in Find & Replace Surge Word 6 03-10-2020 12:42 AM
Replace characters in mergefield Replace All -- inserting a space between two non-consistent characters knpaddac Word 1 01-30-2018 12:52 PM
Replace characters in mergefield 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
Replace characters in mergefield Find and Replace some characters with Bullets kjxavier Word 1 01-02-2015 12:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:08 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft