Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
823 views
in Technique[技术] by (71.8m points)

url - Mailmerge dynamic hyperlink fields lost after save/reload of document - Word 2010

I have a problem where using dynamic hyperlinks in field codes works fine when I create a document, but when save and later reload it the links are replaced with text from the original recordset. The field code I am using is:

{ HYPERLINK { MERGEFIELD "Fieldname" } * MERGEFORMAT }

After saving then reloading the document this becomes similar to:

{ HYPERLINK "http://www.example.com" }

I am merging to HTML email.

I have been unable to get this to successfully work after saving. This is a simplified version of what I'm trying to do and the only part I can't get to work properly. I need to get the mail merge document prepared for someone else to run, rather than be there to set it up each time it needs to be run.

Any help on this would be much appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In addition to inserting the { MERGEFIELD Fieldname } field, insert a uniquely named bookmark via Insert->Bookmark, say, immediately after the mergefield field.

I cannot guarantee that that will "work" in all circumstances, but so far it seems to do the trick. Another possibility if you do not want to have to remember any distinct bookmark names would be to insert a nested field like this instead:

{ SET "mfkeeper{ SEQ mfk }" " " }

If you do that, and update the nested SET field before doing anything else (such as updating the HYPERLINK field), you get a uniquely named bookmark (mfkeeper1, etc.). Whether that is sustainable, I cannot currently tell.

This behaviour gpes some way to explaining why the nested HYPERLINK behaviour seems so arbitrary - if you select the HYPERLINK fields and update them all via F9, Word inserts its _GoBack bookmark into the HYPERLINK field, and that's what seems to prevent Word from resolving the nested MERGEFIELD field.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...