In Access queries I use [Like ("*@*.*")] to determine if the field is an email address. I have an Excel worksheet and wish to determine if a field in that worksheet contains an email address from within a mail-merge document. This is something like an if/else, but I can't find the proper syntax (if there is one).
TIA
Mail-Merge 2010 using "LIKE"
-
- 2StarLounger
- Posts: 125
- Joined: 17 Feb 2010, 16:25
Mail-Merge 2010 using "LIKE"
PaulW
Lost Wages, NV USA
(former Cobol Programmer)
Lost Wages, NV USA
(former Cobol Programmer)
-
- 4StarLounger
- Posts: 508
- Joined: 17 Dec 2010, 03:14
Re: Mail-Merge 2010 using "LIKE"
Word fields don't provide much support for wildcard comparisons. Sure, you can use * (for a variable-length string) and ? (for a single character) in comparisons like ???@* (to find three characters followed by an @ then any number of characters after that), but you can't use *@*. Effectively, that means you'd need to test every position the @ might occur in, via a series of comparisons like ???@*, ????@*, ????@* and so on to find whether you might be dealing with an email address.
Paul Edstein
[Fmr MS MVP - Word]
[Fmr MS MVP - Word]
-
- Administrator
- Posts: 78381
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Mail-Merge 2010 using "LIKE"
Perhaps it'd be easier to filter the data in Excel?
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 125
- Joined: 17 Feb 2010, 16:25
Re: Mail-Merge 2010 using "LIKE"
Thanks to all who replied.
I found the following:
AT (@)
http://www.pcreview.co.uk/forums/scanni ... 98419.html
This code reacts the same way that the Like ("*@*.*") responds in Access.
I am not sure that the mail-merge will accept TRUE and FALSE, so I changed it to return a "Y" or an "N".
I found the following:
Code: Select all
=ISERROR(SEARCH("*@*.*",A1))
http://www.pcreview.co.uk/forums/scanni ... 98419.html
This code reacts the same way that the Like ("*@*.*") responds in Access.
I am not sure that the mail-merge will accept TRUE and FALSE, so I changed it to return a "Y" or an "N".
PaulW
Lost Wages, NV USA
(former Cobol Programmer)
Lost Wages, NV USA
(former Cobol Programmer)
-
- Administrator
- Posts: 78381
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Mail-Merge 2010 using "LIKE"
Good to hear that you found a solution. Thanks for the feedback.
Best wishes,
Hans
Hans