Home |
Search |
Today's Posts |
#1
|
|||
|
|||
mail merge hyperlinks in Word 2003
Is there a trick to keeping hyperlinks when using the Mail Merge feature in
Word 2003 for html emails, I've tried every combination?? Thanks, M |
#2
|
|||
|
|||
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.DataFields("linktext") ' set up the display text that you want. dt = Doc.MailMerge.DataSource.DataFields("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 "M" wrote in message ... Is there a trick to keeping hyperlinks when using the Mail Merge feature in Word 2003 for html emails, I've tried every combination?? Thanks, M |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macros - Keyboard Commands | Microsoft Word Help | |||
Merge in Word 2003 | Mailmerge | |||
faxing from word 2003 mail merge | Mailmerge | |||
How do I create & merge specific data base & master documents? | New Users | |||
Word-Excel 2003 - Mail Merge Recipients problem | Mailmerge |