Reply
 
Thread Tools Display Modes
  #1   Report Post  
Mark V
 
Posts: n/a
Default Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements

Trying to include hyperlinks in Mail Merge IF...THEN...ELSE statements to
have different hyperlinks appear in the resulting Mail Merge to Email based
on values in other Mail Merge fields. For instance, to have different
support or product hyperlinks appear for different recipients depending on
the version of OS or S/W that they are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE statement by
using CNTL-F9 and typing a complete HYPERLINK statement.
- Creating a hyperlink elsewhere in the document (formatted as desired with
Display Text, Screen Tip and Address) and pasting it into the
IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document and using an
INCLUDETEXT statement within the IF...THEN...ELSE statement to add this
document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the text of the
hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge field
Office_Version, an IF...THEN...ELSE statement would be used to display a
message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display "Systems
running this version must upgrade to either Office XP or Office 2003.".

If Office_Version = "Office XP", the message might display "Systems running
this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory accomplish
this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems running this
version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }." "Systems
running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }." }

I am using Microsoft Office Word 2003 (11.5604.5703) from Microsoft Office
Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark

  #2   Report Post  
Graham Mayor
 
Posts: n/a
Default

Saving the hyperlinks as formatted autotext entries and inserting autotext
fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting Mail
Merge to Email based on values in other Mail Merge fields. For
instance, to have different support or product hyperlinks appear for
different recipients depending on the version of OS or S/W that they
are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting it
into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document and
using an INCLUDETEXT statement within the IF...THEN...ELSE statement
to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the text of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge field
Office_Version, an IF...THEN...ELSE statement would be used to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display "Systems
running this version must upgrade to either Office XP or Office
2003.".

If Office_Version = "Office XP", the message might display "Systems
running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems running
this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
"Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
}

I am using Microsoft Office Word 2003 (11.5604.5703) from Microsoft
Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark



  #3   Report Post  
Mark V
 
Posts: n/a
Default

Graham,

Thanks for the quick reply.

Saving the hyperlinks as formatted AutoText entries and inserting them into
the document using the AUTOTEXT field works fine but only the text (not the
hyperlink) appears when the AUTOTEXT field is embedded within the
IF...THEN...ELSE statement. This is exactly what I'm seeing with formatted
hyperlinks that I simply cut and paste into the IF...THEN...ELSE statement.

On a related note, the formatted AutoText entries should be created (by
highlighting the formatted hyperlink and selecting Insert, AutoText, New from
the menu) with paragraph formatting included (by highlighting the paragraph
mark before creating the entry) to ensure that the text looks like a
hyperlink (different color and underlined). If the paragraph formatting
isn't included, the text won't look like a hyperlink but will function as a
hyperlink should the mouse be placed over it.

Any other suggestions for including hyperlinks in IF...THEN...ELSE statements?

Thanks, Mark V

"Graham Mayor" wrote:

Saving the hyperlinks as formatted autotext entries and inserting autotext
fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting Mail
Merge to Email based on values in other Mail Merge fields. For
instance, to have different support or product hyperlinks appear for
different recipients depending on the version of OS or S/W that they
are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting it
into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document and
using an INCLUDETEXT statement within the IF...THEN...ELSE statement
to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the text of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge field
Office_Version, an IF...THEN...ELSE statement would be used to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display "Systems
running this version must upgrade to either Office XP or Office
2003.".

If Office_Version = "Office XP", the message might display "Systems
running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems running
this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
"Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
}

I am using Microsoft Office Word 2003 (11.5604.5703) from Microsoft
Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark




  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default

I tested this before posting and the hyperlinks were inserted in the merged
document here. The Autotexts were reproduced exactly.

{IF {Mergefield fieldname} = condition "{Autotext textname1}" "{Autotext
textname2"}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks for the quick reply.

Saving the hyperlinks as formatted AutoText entries and inserting
them into the document using the AUTOTEXT field works fine but only
the text (not the hyperlink) appears when the AUTOTEXT field is
embedded within the IF...THEN...ELSE statement. This is exactly what
I'm seeing with formatted hyperlinks that I simply cut and paste into
the IF...THEN...ELSE statement.

On a related note, the formatted AutoText entries should be created
(by highlighting the formatted hyperlink and selecting Insert,
AutoText, New from the menu) with paragraph formatting included (by
highlighting the paragraph mark before creating the entry) to ensure
that the text looks like a hyperlink (different color and
underlined). If the paragraph formatting isn't included, the text
won't look like a hyperlink but will function as a hyperlink should
the mouse be placed over it.

Any other suggestions for including hyperlinks in IF...THEN...ELSE
statements?

Thanks, Mark V

"Graham Mayor" wrote:

Saving the hyperlinks as formatted autotext entries and inserting
autotext fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting Mail
Merge to Email based on values in other Mail Merge fields. For
instance, to have different support or product hyperlinks appear for
different recipients depending on the version of OS or S/W that they
are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK
statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting it
into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document and
using an INCLUDETEXT statement within the IF...THEN...ELSE statement
to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the text
of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge field
Office_Version, an IF...THEN...ELSE statement would be used to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display
"Systems running this version must upgrade to either Office XP or
Office 2003.".

If Office_Version = "Office XP", the message might display "Systems
running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems running
this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
"Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
}

I am using Microsoft Office Word 2003 (11.5604.5703) from Microsoft
Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark



  #5   Report Post  
Mark V
 
Posts: n/a
Default

Graham,

Thanks again for the reply.

Please double check if hyperlinks were actually created by using the
statement in your message below or if the resulting text just looked like a
hyperlink (blue and underlined font). I've now tested on another machine
running Word 2003 and two separate machines running Word 2002 and Word 2000.
In each case, the text of the hyperlink appears but the hyperlink is not
active.

A few other observations:
- If the AutoText entry is a hyperlink of one or more words, it will appear
formatted like a hyperlink, however, if it is a string of text with only part
of the string being a hyperlink (like "Click here to send an email" where
"Click here" is a hyperlink and the rest of the string is not), none of this
string will be formatted like a hyperlink.
- If only AUTOTEXT statements are used within the IF statement as in your
example below AND if the entire AutoText entry was created from just a
hyperlink, then the resulting text will appear formatted like a hyperlink,
however, if any text is placed before or after the AUTOTEXT statement (like
"Text before {AUTOTEXT AutoTextEntry1}" or "{AUTOTEXT AutoTextEntry1} text
after") then the resulting text will not be formatted like a hyperlink.
- The appearance of hyperlink formatting (blue and underlined font) for
AutoText inserted into a document appears to be impacted by the document
formatting at the point of insertion. In some cases, the resulting text
doesn't appear to be a hyperlink (not blue and underlined font) although it
is (mousing over changes cursor and displays ScreenTip, clicking goes to
link).
- If, after placing an AUTOTEXT statment within an IF statement, you right
click and select "Update Fields", the result of the statement is displayed.
If you then place the cursor before the first character of the result, right
click and select "Toggle Field Codes", the IF statement will appear with the
AutoText entry as it should appear (as opposed to the AUTOTEXT statment).
This entry is actually an active hyperlink (as it should be) but doesn't
survive the translation within the IF statement when field codes are toggled
back or the field updated to display the result.

Regards, Mark V


"Graham Mayor" wrote:

I tested this before posting and the hyperlinks were inserted in the merged
document here. The Autotexts were reproduced exactly.

{IF {Mergefield fieldname} = condition "{Autotext textname1}" "{Autotext
textname2"}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks for the quick reply.

Saving the hyperlinks as formatted AutoText entries and inserting
them into the document using the AUTOTEXT field works fine but only
the text (not the hyperlink) appears when the AUTOTEXT field is
embedded within the IF...THEN...ELSE statement. This is exactly what
I'm seeing with formatted hyperlinks that I simply cut and paste into
the IF...THEN...ELSE statement.

On a related note, the formatted AutoText entries should be created
(by highlighting the formatted hyperlink and selecting Insert,
AutoText, New from the menu) with paragraph formatting included (by
highlighting the paragraph mark before creating the entry) to ensure
that the text looks like a hyperlink (different color and
underlined). If the paragraph formatting isn't included, the text
won't look like a hyperlink but will function as a hyperlink should
the mouse be placed over it.

Any other suggestions for including hyperlinks in IF...THEN...ELSE
statements?

Thanks, Mark V

"Graham Mayor" wrote:

Saving the hyperlinks as formatted autotext entries and inserting
autotext fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting Mail
Merge to Email based on values in other Mail Merge fields. For
instance, to have different support or product hyperlinks appear for
different recipients depending on the version of OS or S/W that they
are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK
statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting it
into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document and
using an INCLUDETEXT statement within the IF...THEN...ELSE statement
to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the text
of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge field
Office_Version, an IF...THEN...ELSE statement would be used to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display
"Systems running this version must upgrade to either Office XP or
Office 2003.".

If Office_Version = "Office XP", the message might display "Systems
running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems running
this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
"Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx" }."
}

I am using Microsoft Office Word 2003 (11.5604.5703) from Microsoft
Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark






  #6   Report Post  
Graham Mayor
 
Posts: n/a
Default

In that case simply run autoformat on the merged document with the internet
and network paths to hyperlinks option set.

With Options
.AutoFormatApplyHeadings = False
.AutoFormatApplyLists = False
.AutoFormatApplyBulletedLists = False
.AutoFormatApplyOtherParas = False
.AutoFormatReplaceQuotes = False
.AutoFormatReplaceSymbols = False
.AutoFormatReplaceOrdinals = False
.AutoFormatReplaceFractions = False
.AutoFormatReplacePlainTextEmphasis = False
.AutoFormatReplaceHyperlinks = True
.AutoFormatPreserveStyles = False
.AutoFormatPlainTextWordMail = False
End With
Selection.Document.Kind = wdDocumentNotSpecified
Selection.Range.AutoFormat


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks again for the reply.

Please double check if hyperlinks were actually created by using the
statement in your message below or if the resulting text just looked
like a hyperlink (blue and underlined font). I've now tested on
another machine running Word 2003 and two separate machines running
Word 2002 and Word 2000. In each case, the text of the hyperlink
appears but the hyperlink is not active.

A few other observations:
- If the AutoText entry is a hyperlink of one or more words, it will
appear formatted like a hyperlink, however, if it is a string of text
with only part of the string being a hyperlink (like "Click here to
send an email" where "Click here" is a hyperlink and the rest of the
string is not), none of this string will be formatted like a
hyperlink.
- If only AUTOTEXT statements are used within the IF statement as in
your example below AND if the entire AutoText entry was created from
just a hyperlink, then the resulting text will appear formatted like
a hyperlink, however, if any text is placed before or after the
AUTOTEXT statement (like "Text before {AUTOTEXT AutoTextEntry1}" or
"{AUTOTEXT AutoTextEntry1} text after") then the resulting text will
not be formatted like a hyperlink.
- The appearance of hyperlink formatting (blue and underlined font)
for AutoText inserted into a document appears to be impacted by the
document formatting at the point of insertion. In some cases, the
resulting text doesn't appear to be a hyperlink (not blue and
underlined font) although it is (mousing over changes cursor and
displays ScreenTip, clicking goes to link).
- If, after placing an AUTOTEXT statment within an IF statement, you
right click and select "Update Fields", the result of the statement
is displayed. If you then place the cursor before the first character
of the result, right click and select "Toggle Field Codes", the IF
statement will appear with the AutoText entry as it should appear (as
opposed to the AUTOTEXT statment). This entry is actually an active
hyperlink (as it should be) but doesn't survive the translation
within the IF statement when field codes are toggled back or the
field updated to display the result.

Regards, Mark V


"Graham Mayor" wrote:

I tested this before posting and the hyperlinks were inserted in the
merged document here. The Autotexts were reproduced exactly.

{IF {Mergefield fieldname} = condition "{Autotext textname1}"
"{Autotext textname2"}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks for the quick reply.

Saving the hyperlinks as formatted AutoText entries and inserting
them into the document using the AUTOTEXT field works fine but only
the text (not the hyperlink) appears when the AUTOTEXT field is
embedded within the IF...THEN...ELSE statement. This is exactly
what I'm seeing with formatted hyperlinks that I simply cut and
paste into the IF...THEN...ELSE statement.

On a related note, the formatted AutoText entries should be created
(by highlighting the formatted hyperlink and selecting Insert,
AutoText, New from the menu) with paragraph formatting included (by
highlighting the paragraph mark before creating the entry) to ensure
that the text looks like a hyperlink (different color and
underlined). If the paragraph formatting isn't included, the text
won't look like a hyperlink but will function as a hyperlink should
the mouse be placed over it.

Any other suggestions for including hyperlinks in IF...THEN...ELSE
statements?

Thanks, Mark V

"Graham Mayor" wrote:

Saving the hyperlinks as formatted autotext entries and inserting
autotext fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting
Mail Merge to Email based on values in other Mail Merge fields.
For instance, to have different support or product hyperlinks
appear for different recipients depending on the version of OS or
S/W that they are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK
statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting it
into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document
and using an INCLUDETEXT statement within the IF...THEN...ELSE
statement to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the text
of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge
field Office_Version, an IF...THEN...ELSE statement would be used
to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display
"Systems running this version must upgrade to either Office XP or
Office 2003.".

If Office_Version = "Office XP", the message might display
"Systems running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems
running this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." "Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." }

I am using Microsoft Office Word 2003 (11.5604.5703) from
Microsoft Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark



  #7   Report Post  
Mark V
 
Posts: n/a
Default

Graham,

Are you suggesting running AutoFormat (using the options listed below) on
the document after typing in all of the desired AUTOTEXT statements within IF
statements and before completing the merge? If so, this doesn't seem to
change anything.

My understanding of the AutoFormat "Replace Internet and network paths with
hyperlinks" option is that it is intended to identify and create a hyperlink
for any text that looks like an internet or network path. It will not
replace this text with "friendly" text (for instance, taking
"www.microsoft.com", creating a hyperlink to "http://www.microsoft.com" and
setting the Text to Display to "Microsoft") and it has no effect on the
following:
- A URL included within an IF statement (for instance, "{ IF condition
"http://www.microsoft.com" })
- A HYPERLINK statement included within an IF statement (for instance, "{ IF
condition "{ HYPERLINK "http://www.microsoft.com" })
- A hyperlink pasted into an IF statement (which results in adding a
HYPERLINK statement to the IF statement but also sets the Text to Display to
the "friendly" text specified when the hyperlink was created).

It appears that Word (going back to at least Word 2000) has problems
processing hyperlinks within IF statements, regardless of whether they are
manually typed into the IF statement, pasted in, included via a HYPERLINK
statement, included via an INCLUDETEXT statement or included via a AUTOTEXT
statement.

If I'm misinterpreting something or doing something wrong, I'm all ears...

Thanks, Mark V

"Graham Mayor" wrote:

In that case simply run autoformat on the merged document with the internet
and network paths to hyperlinks option set.

With Options
.AutoFormatApplyHeadings = False
.AutoFormatApplyLists = False
.AutoFormatApplyBulletedLists = False
.AutoFormatApplyOtherParas = False
.AutoFormatReplaceQuotes = False
.AutoFormatReplaceSymbols = False
.AutoFormatReplaceOrdinals = False
.AutoFormatReplaceFractions = False
.AutoFormatReplacePlainTextEmphasis = False
.AutoFormatReplaceHyperlinks = True
.AutoFormatPreserveStyles = False
.AutoFormatPlainTextWordMail = False
End With
Selection.Document.Kind = wdDocumentNotSpecified
Selection.Range.AutoFormat


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks again for the reply.

Please double check if hyperlinks were actually created by using the
statement in your message below or if the resulting text just looked
like a hyperlink (blue and underlined font). I've now tested on
another machine running Word 2003 and two separate machines running
Word 2002 and Word 2000. In each case, the text of the hyperlink
appears but the hyperlink is not active.

A few other observations:
- If the AutoText entry is a hyperlink of one or more words, it will
appear formatted like a hyperlink, however, if it is a string of text
with only part of the string being a hyperlink (like "Click here to
send an email" where "Click here" is a hyperlink and the rest of the
string is not), none of this string will be formatted like a
hyperlink.
- If only AUTOTEXT statements are used within the IF statement as in
your example below AND if the entire AutoText entry was created from
just a hyperlink, then the resulting text will appear formatted like
a hyperlink, however, if any text is placed before or after the
AUTOTEXT statement (like "Text before {AUTOTEXT AutoTextEntry1}" or
"{AUTOTEXT AutoTextEntry1} text after") then the resulting text will
not be formatted like a hyperlink.
- The appearance of hyperlink formatting (blue and underlined font)
for AutoText inserted into a document appears to be impacted by the
document formatting at the point of insertion. In some cases, the
resulting text doesn't appear to be a hyperlink (not blue and
underlined font) although it is (mousing over changes cursor and
displays ScreenTip, clicking goes to link).
- If, after placing an AUTOTEXT statment within an IF statement, you
right click and select "Update Fields", the result of the statement
is displayed. If you then place the cursor before the first character
of the result, right click and select "Toggle Field Codes", the IF
statement will appear with the AutoText entry as it should appear (as
opposed to the AUTOTEXT statment). This entry is actually an active
hyperlink (as it should be) but doesn't survive the translation
within the IF statement when field codes are toggled back or the
field updated to display the result.

Regards, Mark V


"Graham Mayor" wrote:

I tested this before posting and the hyperlinks were inserted in the
merged document here. The Autotexts were reproduced exactly.

{IF {Mergefield fieldname} = condition "{Autotext textname1}"
"{Autotext textname2"}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks for the quick reply.

Saving the hyperlinks as formatted AutoText entries and inserting
them into the document using the AUTOTEXT field works fine but only
the text (not the hyperlink) appears when the AUTOTEXT field is
embedded within the IF...THEN...ELSE statement. This is exactly
what I'm seeing with formatted hyperlinks that I simply cut and
paste into the IF...THEN...ELSE statement.

On a related note, the formatted AutoText entries should be created
(by highlighting the formatted hyperlink and selecting Insert,
AutoText, New from the menu) with paragraph formatting included (by
highlighting the paragraph mark before creating the entry) to ensure
that the text looks like a hyperlink (different color and
underlined). If the paragraph formatting isn't included, the text
won't look like a hyperlink but will function as a hyperlink should
the mouse be placed over it.

Any other suggestions for including hyperlinks in IF...THEN...ELSE
statements?

Thanks, Mark V

"Graham Mayor" wrote:

Saving the hyperlinks as formatted autotext entries and inserting
autotext fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting
Mail Merge to Email based on values in other Mail Merge fields.
For instance, to have different support or product hyperlinks
appear for different recipients depending on the version of OS or
S/W that they are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK
statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting it
into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document
and using an INCLUDETEXT statement within the IF...THEN...ELSE
statement to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the text
of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge
field Office_Version, an IF...THEN...ELSE statement would be used
to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display
"Systems running this version must upgrade to either Office XP or
Office 2003.".

If Office_Version = "Office XP", the message might display
"Systems running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems
running this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." "Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." }

I am using Microsoft Office Word 2003 (11.5604.5703) from
Microsoft Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark




  #8   Report Post  
Graham Mayor
 
Posts: n/a
Default

I have done much testing this morning and sadly I have to confirm that the
results you are experiencing are echoed here (Word 2003). I had tested the
autotext entry and that maintained the link, but unfortunately the link (in
common with many other fields) does not follow the merge, though it appeared
to do so, thanks to the formatting.

My previous observation about autoformat related to the use of links without
friendly names, as autoformat will create a hyperlink from an entry that
looks like an e-mail or web address. I have not been able to find a way to
otherwise maintain the link. Sorry if I have led you astray.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Are you suggesting running AutoFormat (using the options listed
below) on the document after typing in all of the desired AUTOTEXT
statements within IF statements and before completing the merge? If
so, this doesn't seem to change anything.

My understanding of the AutoFormat "Replace Internet and network
paths with hyperlinks" option is that it is intended to identify and
create a hyperlink for any text that looks like an internet or
network path. It will not replace this text with "friendly" text
(for instance, taking "www.microsoft.com", creating a hyperlink to
"http://www.microsoft.com" and setting the Text to Display to
"Microsoft") and it has no effect on the following:
- A URL included within an IF statement (for instance, "{ IF condition
"http://www.microsoft.com" })
- A HYPERLINK statement included within an IF statement (for
instance, "{ IF condition "{ HYPERLINK "http://www.microsoft.com" })
- A hyperlink pasted into an IF statement (which results in adding a
HYPERLINK statement to the IF statement but also sets the Text to
Display to the "friendly" text specified when the hyperlink was
created).

It appears that Word (going back to at least Word 2000) has problems
processing hyperlinks within IF statements, regardless of whether
they are manually typed into the IF statement, pasted in, included
via a HYPERLINK statement, included via an INCLUDETEXT statement or
included via a AUTOTEXT statement.

If I'm misinterpreting something or doing something wrong, I'm all
ears...

Thanks, Mark V

"Graham Mayor" wrote:

In that case simply run autoformat on the merged document with the
internet and network paths to hyperlinks option set.

With Options
.AutoFormatApplyHeadings = False
.AutoFormatApplyLists = False
.AutoFormatApplyBulletedLists = False
.AutoFormatApplyOtherParas = False
.AutoFormatReplaceQuotes = False
.AutoFormatReplaceSymbols = False
.AutoFormatReplaceOrdinals = False
.AutoFormatReplaceFractions = False
.AutoFormatReplacePlainTextEmphasis = False
.AutoFormatReplaceHyperlinks = True
.AutoFormatPreserveStyles = False
.AutoFormatPlainTextWordMail = False
End With
Selection.Document.Kind = wdDocumentNotSpecified
Selection.Range.AutoFormat


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks again for the reply.

Please double check if hyperlinks were actually created by using the
statement in your message below or if the resulting text just looked
like a hyperlink (blue and underlined font). I've now tested on
another machine running Word 2003 and two separate machines running
Word 2002 and Word 2000. In each case, the text of the hyperlink
appears but the hyperlink is not active.

A few other observations:
- If the AutoText entry is a hyperlink of one or more words, it will
appear formatted like a hyperlink, however, if it is a string of
text with only part of the string being a hyperlink (like "Click
here to
send an email" where "Click here" is a hyperlink and the rest of the
string is not), none of this string will be formatted like a
hyperlink.
- If only AUTOTEXT statements are used within the IF statement as in
your example below AND if the entire AutoText entry was created from
just a hyperlink, then the resulting text will appear formatted like
a hyperlink, however, if any text is placed before or after the
AUTOTEXT statement (like "Text before {AUTOTEXT AutoTextEntry1}" or
"{AUTOTEXT AutoTextEntry1} text after") then the resulting text will
not be formatted like a hyperlink.
- The appearance of hyperlink formatting (blue and underlined font)
for AutoText inserted into a document appears to be impacted by the
document formatting at the point of insertion. In some cases, the
resulting text doesn't appear to be a hyperlink (not blue and
underlined font) although it is (mousing over changes cursor and
displays ScreenTip, clicking goes to link).
- If, after placing an AUTOTEXT statment within an IF statement, you
right click and select "Update Fields", the result of the statement
is displayed. If you then place the cursor before the first
character
of the result, right click and select "Toggle Field Codes", the IF
statement will appear with the AutoText entry as it should appear
(as opposed to the AUTOTEXT statment). This entry is actually an
active hyperlink (as it should be) but doesn't survive the
translation
within the IF statement when field codes are toggled back or the
field updated to display the result.

Regards, Mark V


"Graham Mayor" wrote:

I tested this before posting and the hyperlinks were inserted in
the merged document here. The Autotexts were reproduced exactly.

{IF {Mergefield fieldname} = condition "{Autotext textname1}"
"{Autotext textname2"}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks for the quick reply.

Saving the hyperlinks as formatted AutoText entries and inserting
them into the document using the AUTOTEXT field works fine but
only the text (not the hyperlink) appears when the AUTOTEXT field
is embedded within the IF...THEN...ELSE statement. This is
exactly
what I'm seeing with formatted hyperlinks that I simply cut and
paste into the IF...THEN...ELSE statement.

On a related note, the formatted AutoText entries should be
created (by highlighting the formatted hyperlink and selecting
Insert, AutoText, New from the menu) with paragraph formatting
included (by highlighting the paragraph mark before creating the
entry) to ensure that the text looks like a hyperlink (different
color and
underlined). If the paragraph formatting isn't included, the text
won't look like a hyperlink but will function as a hyperlink
should the mouse be placed over it.

Any other suggestions for including hyperlinks in IF...THEN...ELSE
statements?

Thanks, Mark V

"Graham Mayor" wrote:

Saving the hyperlinks as formatted autotext entries and inserting
autotext fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting
Mail Merge to Email based on values in other Mail Merge fields.
For instance, to have different support or product hyperlinks
appear for different recipients depending on the version of OS
or S/W that they are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK
statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting
it into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document
and using an INCLUDETEXT statement within the IF...THEN...ELSE
statement to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the
text of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge
field Office_Version, an IF...THEN...ELSE statement would be
used
to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display
"Systems running this version must upgrade to either Office XP
or Office 2003.".

If Office_Version = "Office XP", the message might display
"Systems running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems
running this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." "Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." }

I am using Microsoft Office Word 2003 (11.5604.5703) from
Microsoft Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark



  #9   Report Post  
Mark V
 
Posts: n/a
Default

Graham,

Thanks. Just wanted to make sure I wasn't alone and wasn't missing
something...

Is there a formal process for escalating issues like this to Microsoft for
future consideration or do I just have to cross my fingers and hope that it
gets on their radar (not likely since it's been an issue since at least Word
2000)?

Regards,

Mark

"Graham Mayor" wrote:

I have done much testing this morning and sadly I have to confirm that the
results you are experiencing are echoed here (Word 2003). I had tested the
autotext entry and that maintained the link, but unfortunately the link (in
common with many other fields) does not follow the merge, though it appeared
to do so, thanks to the formatting.

My previous observation about autoformat related to the use of links without
friendly names, as autoformat will create a hyperlink from an entry that
looks like an e-mail or web address. I have not been able to find a way to
otherwise maintain the link. Sorry if I have led you astray.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Are you suggesting running AutoFormat (using the options listed
below) on the document after typing in all of the desired AUTOTEXT
statements within IF statements and before completing the merge? If
so, this doesn't seem to change anything.

My understanding of the AutoFormat "Replace Internet and network
paths with hyperlinks" option is that it is intended to identify and
create a hyperlink for any text that looks like an internet or
network path. It will not replace this text with "friendly" text
(for instance, taking "www.microsoft.com", creating a hyperlink to
"http://www.microsoft.com" and setting the Text to Display to
"Microsoft") and it has no effect on the following:
- A URL included within an IF statement (for instance, "{ IF condition
"http://www.microsoft.com" })
- A HYPERLINK statement included within an IF statement (for
instance, "{ IF condition "{ HYPERLINK "http://www.microsoft.com" })
- A hyperlink pasted into an IF statement (which results in adding a
HYPERLINK statement to the IF statement but also sets the Text to
Display to the "friendly" text specified when the hyperlink was
created).

It appears that Word (going back to at least Word 2000) has problems
processing hyperlinks within IF statements, regardless of whether
they are manually typed into the IF statement, pasted in, included
via a HYPERLINK statement, included via an INCLUDETEXT statement or
included via a AUTOTEXT statement.

If I'm misinterpreting something or doing something wrong, I'm all
ears...

Thanks, Mark V

"Graham Mayor" wrote:

In that case simply run autoformat on the merged document with the
internet and network paths to hyperlinks option set.

With Options
.AutoFormatApplyHeadings = False
.AutoFormatApplyLists = False
.AutoFormatApplyBulletedLists = False
.AutoFormatApplyOtherParas = False
.AutoFormatReplaceQuotes = False
.AutoFormatReplaceSymbols = False
.AutoFormatReplaceOrdinals = False
.AutoFormatReplaceFractions = False
.AutoFormatReplacePlainTextEmphasis = False
.AutoFormatReplaceHyperlinks = True
.AutoFormatPreserveStyles = False
.AutoFormatPlainTextWordMail = False
End With
Selection.Document.Kind = wdDocumentNotSpecified
Selection.Range.AutoFormat


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks again for the reply.

Please double check if hyperlinks were actually created by using the
statement in your message below or if the resulting text just looked
like a hyperlink (blue and underlined font). I've now tested on
another machine running Word 2003 and two separate machines running
Word 2002 and Word 2000. In each case, the text of the hyperlink
appears but the hyperlink is not active.

A few other observations:
- If the AutoText entry is a hyperlink of one or more words, it will
appear formatted like a hyperlink, however, if it is a string of
text with only part of the string being a hyperlink (like "Click
here to
send an email" where "Click here" is a hyperlink and the rest of the
string is not), none of this string will be formatted like a
hyperlink.
- If only AUTOTEXT statements are used within the IF statement as in
your example below AND if the entire AutoText entry was created from
just a hyperlink, then the resulting text will appear formatted like
a hyperlink, however, if any text is placed before or after the
AUTOTEXT statement (like "Text before {AUTOTEXT AutoTextEntry1}" or
"{AUTOTEXT AutoTextEntry1} text after") then the resulting text will
not be formatted like a hyperlink.
- The appearance of hyperlink formatting (blue and underlined font)
for AutoText inserted into a document appears to be impacted by the
document formatting at the point of insertion. In some cases, the
resulting text doesn't appear to be a hyperlink (not blue and
underlined font) although it is (mousing over changes cursor and
displays ScreenTip, clicking goes to link).
- If, after placing an AUTOTEXT statment within an IF statement, you
right click and select "Update Fields", the result of the statement
is displayed. If you then place the cursor before the first
character
of the result, right click and select "Toggle Field Codes", the IF
statement will appear with the AutoText entry as it should appear
(as opposed to the AUTOTEXT statment). This entry is actually an
active hyperlink (as it should be) but doesn't survive the
translation
within the IF statement when field codes are toggled back or the
field updated to display the result.

Regards, Mark V


"Graham Mayor" wrote:

I tested this before posting and the hyperlinks were inserted in
the merged document here. The Autotexts were reproduced exactly.

{IF {Mergefield fieldname} = condition "{Autotext textname1}"
"{Autotext textname2"}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Graham,

Thanks for the quick reply.

Saving the hyperlinks as formatted AutoText entries and inserting
them into the document using the AUTOTEXT field works fine but
only the text (not the hyperlink) appears when the AUTOTEXT field
is embedded within the IF...THEN...ELSE statement. This is
exactly
what I'm seeing with formatted hyperlinks that I simply cut and
paste into the IF...THEN...ELSE statement.

On a related note, the formatted AutoText entries should be
created (by highlighting the formatted hyperlink and selecting
Insert, AutoText, New from the menu) with paragraph formatting
included (by highlighting the paragraph mark before creating the
entry) to ensure that the text looks like a hyperlink (different
color and
underlined). If the paragraph formatting isn't included, the text
won't look like a hyperlink but will function as a hyperlink
should the mouse be placed over it.

Any other suggestions for including hyperlinks in IF...THEN...ELSE
statements?

Thanks, Mark V

"Graham Mayor" wrote:

Saving the hyperlinks as formatted autotext entries and inserting
autotext fields via your conditional field should work.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Mark V wrote:
Trying to include hyperlinks in Mail Merge IF...THEN...ELSE
statements to have different hyperlinks appear in the resulting
Mail Merge to Email based on values in other Mail Merge fields.
For instance, to have different support or product hyperlinks
appear for different recipients depending on the version of OS
or S/W that they are running.

Have tried a number of approaches including:
- Manually adding the hyperlinks within the IF...THEN...ELSE
statement by using CNTL-F9 and typing a complete HYPERLINK
statement.
- Creating a hyperlink elsewhere in the document (formatted as
desired with Display Text, Screen Tip and Address) and pasting
it into the IF...THEN...ELSE statement.
- Creating formatted text and hyperlinks in a separate document
and using an INCLUDETEXT statement within the IF...THEN...ELSE
statement to add this document to the Mail Merge document

In each case, the hyperlink either doesn't appear or only the
text of
the hyperlink appears.

Example:

Depending on the version of Office contained in the Mail Merge
field Office_Version, an IF...THEN...ELSE statement would be
used
to
display a message with relevant hyperlinks.

If Office_Version = "Office 2000", the message might display
"Systems running this version must upgrade to either Office XP
or Office 2003.".

If Office_Version = "Office XP", the message might display
"Systems running this version must upgrade to Office 2003.".

Using the following IF...THEN...ELSE statement should, in theory
accomplish this, but doesn't:

{ IF { MERGEFIELD Office_Version } = "Office 2000" "Systems
running this version must upgrade to either { HYPERLINK
"http://www.microsoft.com/office/previous/xp/default.asp" } or {
HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." "Systems running this version must upgrade to { HYPERLINK
"http://www.microsoft.com/office/editions/prodinfo/default.mspx"
}." }

I am using Microsoft Office Word 2003 (11.5604.5703) from
Microsoft Office Professional Edition 2003.

Any guidance would be appreciated.

Thanks, Mark




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merge - Word 2003/Access 2000 Russell Farr Mailmerge 7 March 24th 06 01:03 AM
How do I eliminate numerous "Mail Merge..." under my tool bar? JulieMae Microsoft Word Help 2 January 9th 05 11:45 PM
mail merge to MAPI as a PDF attachment MikeG Microsoft Word Help 1 December 13th 04 03:12 AM
Mail Merge - Date Format Kilinski Microsoft Word Help 0 December 7th 04 02:13 PM
How do I mail merge when only merge document is shown in tools? DaveAS Microsoft Word Help 2 December 1st 04 04:45 PM


All times are GMT +1. The time now is 01:33 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"