Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Hyperlink with Merge Field
I am using Word 2003 to try to build an email merge that includes a
hyperlink that has a merge field as part of the hyperlink and it is not working. The email received looks correct as shown he ============================================ To verify this email address you registered please click on the following link: To verify this email address you registered please click on the following link: http://westernband.org/verifyemailaddress.aspx/?i=156 ============================================= but the "156" is actually the value of a database field (myID) and when I click on the link in the email it actually uses the following as the link ============================================== http://westernband.org/verifyemailaddress.aspx/?i=myID =============================================== How can I get it to replace that field code with a real value? Wayne |
#2
|
|||
|
|||
Maybe this information posted by fellow MVP Cindy Meister will help:
Quote The only way Word can create a hyperlink is using a Hyperlink field. That means that you have to pass the TEXT (URL) through the mail merge, and nest the merge field into a Hyperlink field. Further, this has to be done as the last step, and the mail merge executed immediately, to a NEW document, before hiding the merge field codes, then updating the fields. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) Unquote -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Wayne Wengert" wrote in message ... I am using Word 2003 to try to build an email merge that includes a hyperlink that has a merge field as part of the hyperlink and it is not working. The email received looks correct as shown he ============================================ To verify this email address you registered please click on the following link: To verify this email address you registered please click on the following link: http://westernband.org/verifyemailaddress.aspx/?i=156 ============================================= but the "156" is actually the value of a database field (myID) and when I click on the link in the email it actually uses the following as the link ============================================== http://westernband.org/verifyemailaddress.aspx/?i=myID =============================================== How can I get it to replace that field code with a real value? Wayne |
#3
|
|||
|
|||
Doug;
Thanks for the response but I don't see how to apply that to an Email Merge - there is no "NEW" document? Wayns "Doug Robbins" wrote in message ... Maybe this information posted by fellow MVP Cindy Meister will help: Quote The only way Word can create a hyperlink is using a Hyperlink field. That means that you have to pass the TEXT (URL) through the mail merge, and nest the merge field into a Hyperlink field. Further, this has to be done as the last step, and the mail merge executed immediately, to a NEW document, before hiding the merge field codes, then updating the fields. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) Unquote -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Wayne Wengert" wrote in message ... I am using Word 2003 to try to build an email merge that includes a hyperlink that has a merge field as part of the hyperlink and it is not working. The email received looks correct as shown he ============================================ To verify this email address you registered please click on the following link: To verify this email address you registered please click on the following link: http://westernband.org/verifyemailaddress.aspx/?i=156 ============================================= but the "156" is actually the value of a database field (myID) and when I click on the link in the email it actually uses the following as the link ============================================== http://westernband.org/verifyemailaddress.aspx/?i=myID =============================================== How can I get it to replace that field code with a real value? Wayne |
#4
|
|||
|
|||
Hi Wayne,
but I don't see how to apply that to an Email Merge - there is no "NEW" document? That's the problem. And when I don't have a lot of time (or patience for experimenting), that's why I avoid these questions. There simply is no "simple" answer. FWIW 1. Don't use Word. There's other software out there that's better for merging to email. You should find a list at slipstick.com 2. Merge to a new document, then use Doug Robbins's tool for pulling the result apart and sending it as separate emails. You should find this on the word.mvps.org site, labelled as something for emailing with attachments. You should be able to use (or adapt) it to email without attachments. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
#5
|
|||
|
|||
Cindy;
Thanks for that information. I'll try an alternate approach. Sure seems like something that Word should be able to do - maybe Word 2010? Wayne "Cindy M -WordMVP-" wrote in message news:VA.0000adf0.00ef49df@speedy... Hi Wayne, but I don't see how to apply that to an Email Merge - there is no "NEW" document? That's the problem. And when I don't have a lot of time (or patience for experimenting), that's why I avoid these questions. There simply is no "simple" answer. FWIW 1. Don't use Word. There's other software out there that's better for merging to email. You should find a list at slipstick.com 2. Merge to a new document, then use Doug Robbins's tool for pulling the result apart and sending it as separate emails. You should find this on the word.mvps.org site, labelled as something for emailing with attachments. You should be able to use (or adapt) it to email without attachments. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
#6
|
|||
|
|||
Another possibility is to use mail merge events and vba to insert the
HYPERLINK fields you need. Here's something I've posted before - probably needs testing and adaptation but may be worth a try. As far as I know: a. as a general rule, you cannot guarantee that HTML features will work as you hope because the recipient's email client may not be configured to display them (or may not be able to do so). But... b. you have to use a { HYPERLINK } field in Word c. a link has two parts: a display text, which is what the user actually sees in the message they receive, and a link text, which is the target that will be opened if the user clicks the link. d. as long as your link is fixed and you have inserted it with the correct display text and link text, and Word has recognised it and turned it into a { HYPERLINK } field, the link should be preserved e. if you are trying to insert hyperlinks "on the fly", e.g. getting the link text from a field in your merge data source, the problem is that although the link text may be updated if you insert the link correctly, the display text is never changed after the { HYPERLINK } field has been created. You can only change the display text programmatically. f. so the only way I know to get around this when merging to e-mail is to use the Word MailMerge events to insert a completely new Hyperlink field for each record in the data source. If you want to go that route, you need to look up Word Events from the Help function in the VBA editor, but for example, if your data source has a column "displaytext" containing the display text you want, and "linktext" containing the link text you want, if you insert a Word bookmark at the point where you want the link and use the following code in the MailMergeBeforeRecordMerge event you may get what you want: Private Sub App_MailMergeBeforeRecordMerge*(ByVal Doc As Document, Cancel As Boolean) Dim dt As String Dim lt As String Dim h As Hyperlink Dim r As Range ' set the range variable to our placeholder bookmark Set r = Doc.Bookmarks("mybm").Range ' delete any existing text (this is needed for records after record 1) r.Text = "" ' construct the link text that you want. lt = Doc.MailMerge.DataSource.DataF*ields("linktext") ' set up the display text that you want. dt = Doc.MailMerge.DataSource.DataF*ields("displaytext" ) 'Or if it should be the same as the link text, do that: 'dt = lt ' insert the hyperlink you want Set h = Doc.Hyperlinks.Add(Anchor:=r, Address:=lt, TextToDisplay:=dt) ' Set mybm to "cover" the inserted link so it is easy to ' delete the old Hyperlink next time Doc.Bookmarks.Add Name:="mybm", Range:=h.Range Set r = Nothing Set h = Nothing End Sub Peter Jamieson "Wayne Wengert" wrote in message ... Cindy; Thanks for that information. I'll try an alternate approach. Sure seems like something that Word should be able to do - maybe Word 2010? Wayne "Cindy M -WordMVP-" wrote in message news:VA.0000adf0.00ef49df@speedy... Hi Wayne, but I don't see how to apply that to an Email Merge - there is no "NEW" document? That's the problem. And when I don't have a lot of time (or patience for experimenting), that's why I avoid these questions. There simply is no "simple" answer. FWIW 1. Don't use Word. There's other software out there that's better for merging to email. You should find a list at slipstick.com 2. Merge to a new document, then use Doug Robbins's tool for pulling the result apart and sending it as separate emails. You should find this on the word.mvps.org site, labelled as something for emailing with attachments. You should be able to use (or adapt) it to email without attachments. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can a merge field be a Hyperlink? | Mailmerge | |||
Home Phone field not getting picked up in Merge | Mailmerge | |||
Email Merge: Need to have URL show as active hyperlink | Mailmerge | |||
suppress invalid merge field word 2003 | Mailmerge | |||
Using MAILMERGE fields within HYPERLINK fields for Merge to Email | Mailmerge |