View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

I don't think it's /just/ the nesting, because if you INCLUDETEXT a
document (or a bookmarked area within a document) that contains a
HYPERLINK field, the link still functions within the document. If you
nest the INCLUDETEXT in the IF, you still have a problem with the
hyperlinks. But if you do e.g.

{ INCLUDETEXT "the path name of a file containing bookmarked areas that
you want to include.doc" { IF { =OR ( { COMPARE { dd_Service } = "ALL"
},{ COMPARE { dd_Service } = "abc" } ) } = 1 "bookmarkname" "nothing" } }

where "bookmarkname" is a bookmark that marks the text etc. that you
need in this case, and "nothing" is the name of a bookmark that does not
mark any text,

then you may get the results you need. But if you include any styled
text (e.g. text with character styles, text that includes paragraph or
section merks etc.) you will probably need to ensure that the styles are
defined the same way in both documents.

Peter Jamieson

http://tips.pjmsn.me.uk

Kent wrote:
I've got a large process document that I'm using a couple of dropdown
fields to filter the selection to help reduce the volume of content.
The reader can either leave it at the defaults for "ALL" regions and
"ALL" services, or they can select an individual region or service
that they want to focus on.

The complex IF works great, except for the Hyperlinks that are within
a majority of the IF statements that direct the reader to external
supporting details, which render my IFs useless, if I can't get to the
details linked to those sections...

Here's a typical example:
{ IF { =OR ( { COMPARE { dd_Service } = "ALL" },{ COMPARE
{ dd_Service } = "abc" } ) } = 1 "For abc - do this, that and the
other. Refer to { HYPERLINK "https://some.sharepoint.server/folder/
details%20file.doc" } for more details, then update the status and
more..." "" }

The other Hyperlinks in the document still work fine. When I first put
the hyperlink within the IF statement, it works fine, until I do the
CTRL-A, F9 to refresh the values selected. More specifically, I'm
copying the URL from the previous version of the document that has
descriptive text to show in the normal view, versus the URL. If I
paste it in while looking at the field codes, I see the HYPERLINK
code, but when I toggle it back to normal view, it shows the URL block
rather than the descriptive text. If I paste it in while I'm in the
normal view, I see the descriptive text, and when I toggle to see the
field codes, it looks like the code above. I can toggle back and it
maintains the descriptive text but loses the the Hyperlink Style (blue
underline)... Then when I select the section, and click F9 to
refresh, and toggle back to field codes, it looks fine with the
HYPERLINK field codes, but when I toggle back to normal view, it just
maintains the descriptive text. It's no longer selectable or clickable
like a hyperlink.

Is it because HYPERLINKs can't be nested, like Barcodes can't be? Or,
is it because the Hyperlink has another pair of quotes that's
confusing the parser (do I need a double-pair to let it process it
once)? Do I need the HYPERLINK within some other field code like a
Function (= ). I can't find anything on the parser rules for this to
determine what else may work... Any help would be greatly appreciated.
Otherwise, I'm going to have to pull the URLs out of the IFs and let
them be visible even when the rest of the content for that block
isn't... Not very slick...

Best Regards,
Kent