Hyperlinks and html images in mailmerge

R

Raza

I'm trying to achieve the following via Mail Merge (initiated by MS CRM 4).

We are creating a marketing email that is supposed to have hyperlinks tagged
with the lead id. E.g. http://www.ultralearn.com/default.aspx?leadid=abcd-efgh

Although this is doable but the entire link must be visible as text. If I do
Ctl+K and place the link in there, the mail merge doesn't replace the lead id
merge field. It remains as ?leadid=<<Lead>>.

I found a macro-solution. I wrote the macro and yes I can append the field
to the hyperlink.address. But I'm not able to use this document that has the
macro in it, in the mail merge. CRM will not allow me to upload a word doc
with macro. I must send the emails from CRM, so that CRM knows that emails
have been sent to which leads.

Another issue is that I want to place an image in the mail that pulls
dynamically from a website. E.g. <img
src="http://www.ultralearn.com/abcd.gif" />

In other words, when a recepient opens their email, the image should load
from the http location and not embedded in the word doc itself.

I am unable to find a place to insert such an html.

Please advise.

Thanks
 
M

macropod

Hi Raza,

You could solve both problems by embedding the mergefield and whatever associated path information you have in a HYPERLINK field.
For example, if the hyperlink path is:
http: //www.ultralearn.com/default.aspx?leadid=«Lead»
you could select all of that and press Ctrl-F9 to embed the string in another field, thus:
{ http: //www.ultralearn.com/default.aspx?leadid=«Lead» }
which you could then edit to read:
{HYPERLINK "http: //www.ultralearn.com/default.aspx?leadid=«Lead»"}
and then run your mailmerge.
 
P

Peter Jamieson

Unfortunately I don't have CRM 4 or know anything about how it is structured
so cannot tell you whether there is any workaround for the "upload document
with macro" issue.

I don't know what macro code you are using to fix the hyperlinks (does it
use Word's Mailmerge events?) but the code does not necessarily have to be
in the document you want to send. As long as you write your code correctly,
it should be possible to put the code in (say) your normal.dot/normal.dotm,
or (preferably) in another .dot(m) that you load as an Addin. However, I
haven't tested that here so cannot be sure.

<<
Another issue is that I want to place an image in the mail that pulls
dynamically from a website. E.g. <img
src="http://www.ultralearn.com/abcd.gif" />

In other words, when a recepient opens their email, the image should load
from the http location and not embedded in the word doc itself.

I'm assuming that you are trying to get the recipient client e-mail to load
the image automatically using the URL you provide, i.e. you're not just
providing a hyperlink that the recipient has to click. i.e. when you look at
the email you're about to send, it has the image, but it's a link to a URL.

Precisely what Word mailmerge can do on this front depends partly on which
versions of Word and Outlook you have, and then some. In other words, some
people seem to have been able to do this in some versions of Word. The last
time I looked was I think with Office 2003, in which I was able to do this
by
a. inserting a nested field such as

{ QUOTE { INCLUDEPICTURE "the URL of the picture" \d } }

/and/

b. unchecking Outlook 2003's Tools->Options->Mail Options->HTML
options->include a copy of the picture rather than a link to the picture
option (I forget the precise wording).

If you leave that option checked, Outlook (or something) generates an
internal CID: reference to an internal MIME part. However, the other person
who tried this could not get the CID: reference to disappear when they
unchecked this option.

Further, the option has disappeared anyway in Outlook 2007. Whether that's
because it was regarded as a security risk, something that people didn't
think they needed any more, or what, I cannot tell you.

Personally, if I were a CRM user, I'd probably contact my MS Account Manager
and ask them whether they know of a way to do it, and perhaps why such
simple stuff is so hard to do.
 
R

rraazz

Hi Raza,

You could solve both problems by embedding the mergefield and whatever associated path information you have in a HYPERLINK field.
For example, if the hyperlink path is:
http: //www.ultralearn.com/default.aspx?leadid=«Lead»
you could select all of that and press Ctrl-F9 to embed the string in another field, thus:
{ http: //www.ultralearn.com/default.aspx?leadid=«Lead» }
which you could then edit to read:
{HYPERLINK "http: //www.ultralearn.com/default.aspx?leadid=«Lead»"}
and then run your mailmerge.

Hi macropod,

Thanks for the tip. Another colleague of mine gave me the same and it
did the trick. In other words, doing ALT F9 and inserting fields the
way you have mentioned is the answer.

But, there is one issue! Once you save save the doc as xml (required
for importing into CRM as template), and reopen it, same issue: no
fields there. I opened the xml in notepad and tried to force-insert
<<Lead>> but doesn't work. It looks like the xml structure won't allow
embedding a MERGEFIELD within a hyperlink. So for now, we'll rely on
copy-paste technology to send out mail merge... unless you can suggest
something here too!

Regards
Raza
 
P

Peter Jamieson

<<
fields there. I opened the xml in notepad and tried to force-insert

It's a bit difficult to explain this, but...

This wouldn't be enough anyway because even if this XML format can encode a
mergefield within a hyperlink, you need the XML equivalent of the MERGEFIELD
field code { MERGEFIELD Lead }, not the "visible" version <<Lead>>.

I have had a look at this and the problem seems to be that whenever Word
saves in /any/ XML type format (i.e. .docx, .xml (Word 2007 version), and
probably .xml (Word 2003 version), and probably .docm, it actually encodes a
HYPERLINK field as a "simple" HYPERLINK field, which means that the thing it
refers to is encoded in a Relationship, and the target of that relationship
can, as far as I can tell, only be a piece of plain text such as
http://whatever. You may be able to see this by looking inside the .xml
file. So when you save, close, and re-open the file, the field codes nested
inside the HYPERLINK disappear and are replaced by their results.

However, you /may/ be able to fix this by forcing Word to use the other
method it has of XML-encoding nested fields, which basically encodes all the
characters in the fields including the start and end braces.

To try this, I suggest you do the following:
a. create a simple document and connect it to your data source.
b. insert the HYPERLINK field and the nested MERGEFIELD field. When you
press F9 you might have something like

{ HYPERLINK "{ MERGEFIELD Lead }" }

Now change "HYPERLINK" to "MERGEFIELD" (yes, I know it doesn't really make
sense!)

Save the document in .xml format. Try re-opening it. The nested fields
should still be there.

Now open it as an XML file, e.g. in notepad, locate the text MERGEFIELD. It
should be in a piece of XML code that looks something like

<w:fldChar w:fldCharType="begin"/></w:r><w:r><w:instrText
xml:space="preserve"> MERGEFIELD "

change MERGEFIELD to HYPERLINK, save and close the XML file, and try
re-opening it. You should see the HYPERLINK field with the nested MERGEFIELD
field.

On the surface, this works with the 2007 version of the .xml format. If you
have to use the 2003 version, things may be different.

However, I cannot tell whether this will actually /also/ achieve your
objectives and not suffer from unwanted side-effects.


--
Peter Jamieson
http://tips.pjmsn.me.uk

Hi Raza,

You could solve both problems by embedding the mergefield and whatever
associated path information you have in a HYPERLINK field.
For example, if the hyperlink path is:
http: //www.ultralearn.com/default.aspx?leadid=«Lead»
you could select all of that and press Ctrl-F9 to embed the string in
another field, thus:
{ http: //www.ultralearn.com/default.aspx?leadid=«Lead» }
which you could then edit to read:
{HYPERLINK "http: //www.ultralearn.com/default.aspx?leadid=«Lead»"}
and then run your mailmerge.

Hi macropod,

Thanks for the tip. Another colleague of mine gave me the same and it
did the trick. In other words, doing ALT F9 and inserting fields the
way you have mentioned is the answer.

But, there is one issue! Once you save save the doc as xml (required
for importing into CRM as template), and reopen it, same issue: no
fields there. I opened the xml in notepad and tried to force-insert
<<Lead>> but doesn't work. It looks like the xml structure won't allow
embedding a MERGEFIELD within a hyperlink. So for now, we'll rely on
copy-paste technology to send out mail merge... unless you can suggest
something here too!

Regards
Raza
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top