Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

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
  #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

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.

At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...

By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}

If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.

I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).

So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).

If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!

Regards,
Kent

On 22 Aug, 07:37, Peter Jamieson
wrote:
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- Hide quoted text -


- Show quoted text -


  #4   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)

that I could put all of the fragments into one separate document, with
bookmarks for
each piece.


I probably should have spelled that out.

I wasn't crazy about having to maintain 2 different
documents


No, it's a pain.

By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}


Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.

{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}

(which does not show the hyperlink behaviour) rather than

{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}

(which does).

Something to bear in mind if you hadn't noticed that you'd left a space
in there!

Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
..Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.

Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.

AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.

Peter Jamieson

http://tips.pjmsn.me.uk

Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.

At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...

By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}

If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.

I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).

So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).

If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!

Regards,
Kent

On 22 Aug, 07:37, Peter Jamieson
wrote:
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- Hide quoted text -

- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.

But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.

Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.

Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...

Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...

Thanks for the advise.

Kent

On Aug 23, 3:26*am, Peter Jamieson
wrote:
* that I could put all of the fragments into one separate document, with
* bookmarks for
* each piece.

I probably should have spelled that out.

* I wasn't crazy about having to maintain 2 different
* documents

No, it's a pain.

* By the way logic works both ways.
* Example 1:
* {IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
* { dd_Service } = "UC" }) } = 1
* "{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}

Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.

{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}

(which does not show the hyperlink behaviour) rather than

{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}

(which does).

Something to bear in mind if you hadn't noticed that you'd left a space
in there!

Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.

Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.

AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.


At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...


By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}


If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.


I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).


So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).


If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!


Regards,
Kent


On 22 Aug, 07:37, Peter Jamieson
wrote:
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- Hide quoted text -
- Show quoted text -- Hide quoted text -


- Show quoted text -




  #6   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 just wish this SOB would react consistently so I could address the
issues appropriately.


IKWYM.

It keeps failing on the
Filename, when
I wasn't changing anything


If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e.g.
caching it locally etc.).

You may be abe to do something with macropod's discovery that you can
use something like

{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}

to get Word to resolve the INCLUDETEXT fields completely as it goes along.

it keeps repositioning where the quotes
are being position (behind
the Macro reference"


I lost you on this one, sorry...

Peter Jamieson

http://tips.pjmsn.me.uk

Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.

But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.

Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.

Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...

Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...

Thanks for the advise.

Kent

On Aug 23, 3:26 am, Peter Jamieson
wrote:
that I could put all of the fragments into one separate document, with
bookmarks for
each piece.


I probably should have spelled that out.

I wasn't crazy about having to maintain 2 different
documents


No, it's a pain.

By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}


Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.

{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}

(which does not show the hyperlink behaviour) rather than

{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}

(which does).

Something to bear in mind if you hadn't noticed that you'd left a space
in there!

Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.

Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.

AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.
At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}
If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.
I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).
So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).
If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!
Regards,
Kent
On 22 Aug, 07:37, Peter Jamieson
wrote:
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- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

Regarding moving the quotes, in our examples the structure looks like:
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} "

However, after updating the field (F9) it would sometimes move the
closing quote
following the filename to behind the bookmark, like:
"{INCLUDETEXT "File_of_Includes bookmarkforUC_1"} "

When I started getting the Invalide filename, I noticed that actually
smashed the
bookmark into the end of the filename, so there was no space between
them. I'll try
again this morning.

Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)? I guess I assumed that it wouldn't resolve
and include the
file/bookmark if the condition wasn't met first. But, it's probably
resolving inside-out with
the filename and bookmark first, then determining if it should display
only if the
conditions are true. I'm just speculating based on my earlier life as
a programmer
....a LONG time ago. This is a bit of stretch for me now, but like I
said, I'm trying to keep
it simple for those that I'll be leaving it with.

May be I could pull the filename from a document variable, but it
would
probably have the same problem once it resolved the filename. Worth
checking...

Kent

On Aug 24, 2:56*am, Peter Jamieson
wrote:
* I just wish this SOB would react consistently so I could address the
* issues appropriately.

IKWYM.

* It keeps failing on the
* Filename, when
* I wasn't changing anything

If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e.g.
caching it locally etc.).

You may be abe to do something with macropod's discovery that you can
use something like

{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}

to get Word to resolve the INCLUDETEXT fields completely as it goes along..

* it keeps repositioning where the quotes
* are being position (behind
* the Macro reference"

I lost you on this one, sorry...

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.


But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.


Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.


Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...


Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...


*Thanks for the advise.


Kent


On Aug 23, 3:26 am, Peter Jamieson
wrote:
* that I could put all of the fragments into one separate document, with
* bookmarks for
* each piece.


I probably should have spelled that out.


* I wasn't crazy about having to maintain 2 different
* documents


No, it's a pain.


* By the way logic works both ways.
* Example 1:
* {IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
* { dd_Service } = "UC" }) } = 1
* "{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}


Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.


{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}


(which does not show the hyperlink behaviour) rather than


{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}


(which does).


Something to bear in mind if you hadn't noticed that you'd left a space
in there!


Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.


Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.


AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.


Peter Jamieson


http://tips.pjmsn.me.uk


Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.
At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}
If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.
I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).
So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).
If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!
Regards,
Kent
On 22 Aug, 07:37, Peter Jamieson
wrote:
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"


...

read more »- Hide quoted text -

- Show quoted text -


  #8   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)

Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)?


I suspect that that is the normal pattern of execution, but MS could
well have hard-coded some exceptions.

You can verify that some fields are always executed regardless by doing e.g.

{ SEQ X }
{ IF 1 = 1 { SEQ X } { SEQ X } }
{ SEQ X }

Peter Jamieson

http://tips.pjmsn.me.uk

Kent wrote:
Regarding moving the quotes, in our examples the structure looks like:
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} "

However, after updating the field (F9) it would sometimes move the
closing quote
following the filename to behind the bookmark, like:
"{INCLUDETEXT "File_of_Includes bookmarkforUC_1"} "

When I started getting the Invalide filename, I noticed that actually
smashed the
bookmark into the end of the filename, so there was no space between
them. I'll try
again this morning.

Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)? I guess I assumed that it wouldn't resolve
and include the
file/bookmark if the condition wasn't met first. But, it's probably
resolving inside-out with
the filename and bookmark first, then determining if it should display
only if the
conditions are true. I'm just speculating based on my earlier life as
a programmer
...a LONG time ago. This is a bit of stretch for me now, but like I
said, I'm trying to keep
it simple for those that I'll be leaving it with.

May be I could pull the filename from a document variable, but it
would
probably have the same problem once it resolved the filename. Worth
checking...

Kent

On Aug 24, 2:56 am, Peter Jamieson
wrote:
I just wish this SOB would react consistently so I could address the
issues appropriately.


IKWYM.

It keeps failing on the
Filename, when
I wasn't changing anything


If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e.g.
caching it locally etc.).

You may be abe to do something with macropod's discovery that you can
use something like

{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}

to get Word to resolve the INCLUDETEXT fields completely as it goes along.

it keeps repositioning where the quotes
are being position (behind
the Macro reference"


I lost you on this one, sorry...

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.
But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.
Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.
Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...
Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...
Thanks for the advise.
Kent
On Aug 23, 3:26 am, Peter Jamieson
wrote:
that I could put all of the fragments into one separate document, with
bookmarks for
each piece.
I probably should have spelled that out.
I wasn't crazy about having to maintain 2 different
documents
No, it's a pain.
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}
(which does not show the hyperlink behaviour) rather than
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
(which does).
Something to bear in mind if you hadn't noticed that you'd left a space
in there!
Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.
Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.
AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.
At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}
If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.
I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).
So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).
If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!
Regards,
Kent
On 22 Aug, 07:37, Peter Jamieson
wrote:
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"

...

read more »- Hide quoted text -

- Show quoted text -


  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

Peter,
I figured out why I was having problems with the Filename. I thought
it was
the format, but was actually the external Links that the INCLUDETEXT
was
building. Initially when I tested this approach, I was in a higher-
level folder, but
I copied the file and the Incldue file into a new folder, so it broke
the links. Or, it
got confused, since I had tried it out on probably 10 different
slightly different
formats, between running Updates, and making Adjustments, Word had
10+
different links for the same bookmark, and same section of
INCLUDETEXT... I
cleaned them up, and figured out a way to point them to the right
location
using a Hyperlink as part of a SET statement to assign the path to a
variable,
which I then reference within my IncludeText. I put the details in a
Thread over
on Microsoft's site where you were responding to some related
questions on
INCLUDETEXT.

I still have 2 outstanding issues with it, that I can probably just
live with for now...
1) Bulleting/sub-bullets are still hit and miss. It was interesting
that a given bookmark
could be at one bullet level, and contain several sub-bullets, and
maintain numbering of
the sub-bullets when it was included in the main document. The only
problem is that main
bullet doesn't show for some reason, probably because Word is confused
by the mixed
styles. I can split it so I have an Include for the main bullet and
another for the sub-bullets,
and that seems to work a little better, but then the first sub-bullet
doesn't show a number.

2) I'm a bit concerned about all of the external Links that Word is
generating. I'll need to
experiment with this to see what I need to do when I move it to
another folder, like when
I'm ready for others to access it on SharePoint. I'm not sure if I can
simply use my Set
Hyperlink approach, and then when I Select All - F9 if it will replace
them all or if it will
just add to the existing ones, and confuse it again. I'll try a test
on this tomorrow. Otherwise,
I'll need to set up some type of macro to select and delete all of the
Links, so I can rebuild them
or trigger a manual update, or something... Thoughts?

Kent

On Aug 24, 8:05*am, Kent wrote:
Regarding moving the quotes, in our examples the structure looks like:
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} "

However, after updating the field (F9) it would sometimes move the
closing quote
following the filename to behind the bookmark, like:
"{INCLUDETEXT "File_of_Includes bookmarkforUC_1"} "

When I started getting the Invalide filename, I noticed that actually
smashed the
bookmark into the end of the filename, so there was no space between
them. I'll try
again this morning.

Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)? I guess I assumed that it wouldn't resolve
and include the
file/bookmark if the condition wasn't met first. But, it's probably
resolving inside-out with
the filename and bookmark first, then determining if it should display
only if the
conditions are true. I'm just speculating based on my earlier life as
a programmer
...a LONG time ago. This is a bit of stretch for me now, but like I
said, I'm trying to keep
it simple for those that I'll be leaving it with.

May be I could pull the filename from a document variable, but it
would
probably have the same problem once it resolved the filename. Worth
checking...

Kent

On Aug 24, 2:56*am, Peter Jamieson
wrote:



* I just wish this SOB would react consistently so I could address the
* issues appropriately.


IKWYM.


* It keeps failing on the
* Filename, when
* I wasn't changing anything


If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e.g.
caching it locally etc.).


You may be abe to do something with macropod's discovery that you can
use something like


{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}


to get Word to resolve the INCLUDETEXT fields completely as it goes along.


* it keeps repositioning where the quotes
* are being position (behind
* the Macro reference"


I lost you on this one, sorry...


Peter Jamieson


http://tips.pjmsn.me.uk


Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.


But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.


Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.


Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...


Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...


*Thanks for the advise.


Kent


On Aug 23, 3:26 am, Peter Jamieson
wrote:
* that I could put all of the fragments into one separate document, with
* bookmarks for
* each piece.


I probably should have spelled that out.


* I wasn't crazy about having to maintain 2 different
* documents


No, it's a pain.


* By the way logic works both ways.
* Example 1:
* {IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
* { dd_Service } = "UC" }) } = 1
* "{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}


Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.


{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}


(which does not show the hyperlink behaviour) rather than


{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}


(which does).


Something to bear in mind if you hadn't noticed that you'd left a space
in there!


Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.


Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.


AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.


Peter Jamieson


http://tips.pjmsn.me.uk


Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.
At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}
If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.
I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).
So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).
If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!
Regards,
Kent
On 22 Aug, 07:37, Peter Jamieson
wrote:
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


...

read more »- Hide quoted text -

- Show quoted text -


  #10   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)

re. the bullets/numbering, I don't have any more suggestions right now.

re. the INCLUDETEXT thing, you can (rather fortuitously) implement a
"relative addressing" scheme using the { FILENAME \p } field as the
base, e.g. to construct the path of a file in the same folder oas the
including file, use


"{ FILENAME \p }\\..\\includedfilename.doc"

macropod expanded this and wrote it up at

http://www.wopr.com/index.php?showto...#entry670 027

I would guess that you can do a

{ SET includedfilepath "{ FILENAME \p }\\..\\includedfilename.doc" }
then
{ INCLUDEFILE "{ includedfilepath }" bookmark }

or something similar.

Peter Jamieson

http://tips.pjmsn.me.uk

Kent wrote:
Peter,
I figured out why I was having problems with the Filename. I thought
it was
the format, but was actually the external Links that the INCLUDETEXT
was
building. Initially when I tested this approach, I was in a higher-
level folder, but
I copied the file and the Incldue file into a new folder, so it broke
the links. Or, it
got confused, since I had tried it out on probably 10 different
slightly different
formats, between running Updates, and making Adjustments, Word had
10+
different links for the same bookmark, and same section of
INCLUDETEXT... I
cleaned them up, and figured out a way to point them to the right
location
using a Hyperlink as part of a SET statement to assign the path to a
variable,
which I then reference within my IncludeText. I put the details in a
Thread over
on Microsoft's site where you were responding to some related
questions on
INCLUDETEXT.

I still have 2 outstanding issues with it, that I can probably just
live with for now...
1) Bulleting/sub-bullets are still hit and miss. It was interesting
that a given bookmark
could be at one bullet level, and contain several sub-bullets, and
maintain numbering of
the sub-bullets when it was included in the main document. The only
problem is that main
bullet doesn't show for some reason, probably because Word is confused
by the mixed
styles. I can split it so I have an Include for the main bullet and
another for the sub-bullets,
and that seems to work a little better, but then the first sub-bullet
doesn't show a number.

2) I'm a bit concerned about all of the external Links that Word is
generating. I'll need to
experiment with this to see what I need to do when I move it to
another folder, like when
I'm ready for others to access it on SharePoint. I'm not sure if I can
simply use my Set
Hyperlink approach, and then when I Select All - F9 if it will replace
them all or if it will
just add to the existing ones, and confuse it again. I'll try a test
on this tomorrow. Otherwise,
I'll need to set up some type of macro to select and delete all of the
Links, so I can rebuild them
or trigger a manual update, or something... Thoughts?

Kent

On Aug 24, 8:05 am, Kent wrote:
Regarding moving the quotes, in our examples the structure looks like:
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} "

However, after updating the field (F9) it would sometimes move the
closing quote
following the filename to behind the bookmark, like:
"{INCLUDETEXT "File_of_Includes bookmarkforUC_1"} "

When I started getting the Invalide filename, I noticed that actually
smashed the
bookmark into the end of the filename, so there was no space between
them. I'll try
again this morning.

Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)? I guess I assumed that it wouldn't resolve
and include the
file/bookmark if the condition wasn't met first. But, it's probably
resolving inside-out with
the filename and bookmark first, then determining if it should display
only if the
conditions are true. I'm just speculating based on my earlier life as
a programmer
...a LONG time ago. This is a bit of stretch for me now, but like I
said, I'm trying to keep
it simple for those that I'll be leaving it with.

May be I could pull the filename from a document variable, but it
would
probably have the same problem once it resolved the filename. Worth
checking...

Kent

On Aug 24, 2:56 am, Peter Jamieson
wrote:



I just wish this SOB would react consistently so I could address the
issues appropriately.
IKWYM.
It keeps failing on the
Filename, when
I wasn't changing anything
If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e.g.
caching it locally etc.).
You may be abe to do something with macropod's discovery that you can
use something like
{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}
to get Word to resolve the INCLUDETEXT fields completely as it goes along.
it keeps repositioning where the quotes
are being position (behind
the Macro reference"
I lost you on this one, sorry...
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.
But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.
Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.
Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...
Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...
Thanks for the advise.
Kent
On Aug 23, 3:26 am, Peter Jamieson
wrote:
that I could put all of the fragments into one separate document, with
bookmarks for
each piece.
I probably should have spelled that out.
I wasn't crazy about having to maintain 2 different
documents
No, it's a pain.
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}
(which does not show the hyperlink behaviour) rather than
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
(which does).
Something to bear in mind if you hadn't noticed that you'd left a space
in there!
Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.
Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.
AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.
At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}
If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.
I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).
So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).
If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!
Regards,
Kent
On 22 Aug, 07:37, Peter Jamieson
wrote:
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

...

read more »- Hide quoted text -

- Show quoted text -




  #11   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

I tested it out, using the INCLUDETEXT "DocProperty includefile"
bookmark. I used macropod's script to figure out what I'd need to do.
The Filename/p \\..\\includefile didn't really work, but the autoexec
macro did, but I still had problems with the LINKs weren't updating
consistently. Then when I moved it to a Sharepoint to test how others
would access it, I was able to modify the DocProperty so it would
work. However, when I tried to build in the steps that a novice would
need to do in order to manage this if they needed to move it to their
local machine, I ran to even more issues. Most of which I was able to
get around, but it got fairly painful... Then after I got it working
(sort of) then everytime I'd refresh the document, the LINKs would
drive me crazy. Sometimes even just opening the document clean, the
LINKs would be screwed up.

So, I went back to square one, with my original context.
{ 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..." "" } -- I figured out two things.

1) After you copy in the Hyperlink into the middle of the text, you
may need to replace the descriptive text for the Link, and reset the
style as a hyperlink. Then select it and update, then toggle to
verify.
2) Readers can see the hyperlink, but it doesn't present with the CTRL-
click to follow it. You just need to right-click, then "Toggle Field
Codes" then they can CTRL-click on the hyperlink. In essence, if the
main document is on one level, the Hyperlink within the IF is down one
level.

It's not quite as clean as being able to follow the link from the top
level, but it doesn't require a bunch of additional coding, extra
include files, or having to rely on what someone else may do with the
include files, or rely on the inconsistency of Word itself....

Best of luck,
Kent

On Aug 25, 2:22*am, Peter Jamieson
wrote:
re. the bullets/numbering, I don't have any more suggestions right now.

re. the INCLUDETEXT thing, you can (rather fortuitously) implement a
"relative addressing" scheme using the { FILENAME \p } field as the
base, e.g. to construct the path of a file in the same folder oas the
including file, use

"{ FILENAME \p }\\..\\includedfilename.doc"

macropod expanded this and wrote it up at

http://www.wopr.com/index.php?showto...70027&#entry67...

I would guess that you can do a

{ SET includedfilepath "{ FILENAME \p }\\..\\includedfilename.doc" }
then
{ INCLUDEFILE "{ includedfilepath }" bookmark }

or something similar.

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
Peter,
I figured out why I was having problems with the Filename. I thought
it was
the format, but was actually the external Links that the INCLUDETEXT
was
building. Initially when I tested this approach, I was in a higher-
level folder, but
I copied the file and the Incldue file into a new folder, so it broke
the links. Or, it
got confused, since I had tried it out on probably 10 different
slightly different
formats, between running Updates, and making Adjustments, Word had
10+
different links for the same bookmark, and same section of
INCLUDETEXT... I
cleaned them up, and figured out a way to point them to the right
location
using a Hyperlink as part of a SET statement to assign the path to a
variable,
which I then reference within my IncludeText. I put the details in a
Thread over
on Microsoft's site where you were responding to some related
questions on
INCLUDETEXT.


I still have 2 outstanding issues with it, that I can probably just
live with for now...
1) Bulleting/sub-bullets are still hit and miss. It was interesting
that a given bookmark
could be at one bullet level, and contain several sub-bullets, and
maintain numbering of
the sub-bullets when it was included in the main document. The only
problem is that main
bullet doesn't show for some reason, probably because Word is confused
by the mixed
styles. I can split it so I have an Include for the main bullet and
another for the sub-bullets,
and that seems to work a little better, but then the first sub-bullet
doesn't show a number.


2) I'm a bit concerned about all of the external Links that Word is
generating. I'll need to
experiment with this to see what I need to do when I move it to
another folder, like when
I'm ready for others to access it on SharePoint. I'm not sure if I can
simply use my Set
Hyperlink approach, and then when I Select All - F9 if it will replace
them all or if it will
just add to the existing ones, and confuse it again. I'll try a test
on this tomorrow. Otherwise,
I'll need to set up some type of macro to select and delete all of the
Links, so I can rebuild them
or trigger a manual update, or something... Thoughts?


Kent


On Aug 24, 8:05 am, Kent wrote:
Regarding moving the quotes, in our examples the structure looks like:
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} "


However, after updating the field (F9) it would sometimes move the
closing quote
following the filename to behind the bookmark, like:
"{INCLUDETEXT "File_of_Includes bookmarkforUC_1"} "


When I started getting the Invalide filename, I noticed that actually
smashed the
bookmark into the end of the filename, so there was no space between
them. I'll try
again this morning.


Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)? I guess I assumed that it wouldn't resolve
and include the
file/bookmark if the condition wasn't met first. But, it's probably
resolving inside-out with
the filename and bookmark first, then determining if it should display
only if the
conditions are true. I'm just speculating based on my earlier life as
a programmer
...a LONG time ago. This is a bit of stretch for me now, but like I
said, I'm trying to keep
it simple for those that I'll be leaving it with.


May be I could pull the filename from a document variable, but it
would
probably have the same problem once it resolved the filename. Worth
checking...


Kent


On Aug 24, 2:56 am, Peter Jamieson
wrote:


* I just wish this SOB would react consistently so I could address the
* issues appropriately.
IKWYM.
* It keeps failing on the
* Filename, when
* I wasn't changing anything
If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e.g..
caching it locally etc.).
You may be abe to do something with macropod's discovery that you can
use something like
{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}
to get Word to resolve the INCLUDETEXT fields completely as it goes along.
* it keeps repositioning where the quotes
* are being position (behind
* the Macro reference"
I lost you on this one, sorry...
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.
But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.
Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.
Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...
Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...
*Thanks for the advise.
Kent
On Aug 23, 3:26 am, Peter Jamieson
wrote:
* that I could put all of the fragments into one separate document, with
* bookmarks for
* each piece.
I probably should have spelled that out.
* I wasn't crazy about having to maintain 2 different
* documents
No, it's a pain.
* By the way logic works both ways.
* Example 1:
* {IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
* { dd_Service } = "UC" }) } = 1
* "{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e..
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}
(which does not show the hyperlink behaviour) rather than
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
(which does).
Something to bear in mind if you hadn't noticed that you'd left a space
in there!
Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.
Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.
AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.
At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each


...

read more »- Hide quoted text -

- Show quoted text -


  #12   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)

Thanks for posting back.

I would dearly love to pass this example back to the people at Microsoft
(if I could), who I am pretty sure now have the mindset that anyone
trying to do anything of this general nature should be coding it with
..NET and possibly VSTO. /Why/ anyone images that that is either easier
or more secure - particularly when you have to deal with more than one
version of Word - than overhauling the field code system so that it
behaves in a more predictable and useful way is actually beyond me.

Peter Jamieson

http://tips.pjmsn.me.uk

Kent wrote:
I tested it out, using the INCLUDETEXT "DocProperty includefile"
bookmark. I used macropod's script to figure out what I'd need to do.
The Filename/p \\..\\includefile didn't really work, but the autoexec
macro did, but I still had problems with the LINKs weren't updating
consistently. Then when I moved it to a Sharepoint to test how others
would access it, I was able to modify the DocProperty so it would
work. However, when I tried to build in the steps that a novice would
need to do in order to manage this if they needed to move it to their
local machine, I ran to even more issues. Most of which I was able to
get around, but it got fairly painful... Then after I got it working
(sort of) then everytime I'd refresh the document, the LINKs would
drive me crazy. Sometimes even just opening the document clean, the
LINKs would be screwed up.

So, I went back to square one, with my original context.
{ 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..." "" } -- I figured out two things.

1) After you copy in the Hyperlink into the middle of the text, you
may need to replace the descriptive text for the Link, and reset the
style as a hyperlink. Then select it and update, then toggle to
verify.
2) Readers can see the hyperlink, but it doesn't present with the CTRL-
click to follow it. You just need to right-click, then "Toggle Field
Codes" then they can CTRL-click on the hyperlink. In essence, if the
main document is on one level, the Hyperlink within the IF is down one
level.

It's not quite as clean as being able to follow the link from the top
level, but it doesn't require a bunch of additional coding, extra
include files, or having to rely on what someone else may do with the
include files, or rely on the inconsistency of Word itself....

Best of luck,
Kent

On Aug 25, 2:22 am, Peter Jamieson
wrote:
re. the bullets/numbering, I don't have any more suggestions right now.

re. the INCLUDETEXT thing, you can (rather fortuitously) implement a
"relative addressing" scheme using the { FILENAME \p } field as the
base, e.g. to construct the path of a file in the same folder oas the
including file, use

"{ FILENAME \p }\\..\\includedfilename.doc"

macropod expanded this and wrote it up at

http://www.wopr.com/index.php?showto...70027&#entry67...

I would guess that you can do a

{ SET includedfilepath "{ FILENAME \p }\\..\\includedfilename.doc" }
then
{ INCLUDEFILE "{ includedfilepath }" bookmark }

or something similar.

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
Peter,
I figured out why I was having problems with the Filename. I thought
it was
the format, but was actually the external Links that the INCLUDETEXT
was
building. Initially when I tested this approach, I was in a higher-
level folder, but
I copied the file and the Incldue file into a new folder, so it broke
the links. Or, it
got confused, since I had tried it out on probably 10 different
slightly different
formats, between running Updates, and making Adjustments, Word had
10+
different links for the same bookmark, and same section of
INCLUDETEXT... I
cleaned them up, and figured out a way to point them to the right
location
using a Hyperlink as part of a SET statement to assign the path to a
variable,
which I then reference within my IncludeText. I put the details in a
Thread over
on Microsoft's site where you were responding to some related
questions on
INCLUDETEXT.
I still have 2 outstanding issues with it, that I can probably just
live with for now...
1) Bulleting/sub-bullets are still hit and miss. It was interesting
that a given bookmark
could be at one bullet level, and contain several sub-bullets, and
maintain numbering of
the sub-bullets when it was included in the main document. The only
problem is that main
bullet doesn't show for some reason, probably because Word is confused
by the mixed
styles. I can split it so I have an Include for the main bullet and
another for the sub-bullets,
and that seems to work a little better, but then the first sub-bullet
doesn't show a number.
2) I'm a bit concerned about all of the external Links that Word is
generating. I'll need to
experiment with this to see what I need to do when I move it to
another folder, like when
I'm ready for others to access it on SharePoint. I'm not sure if I can
simply use my Set
Hyperlink approach, and then when I Select All - F9 if it will replace
them all or if it will
just add to the existing ones, and confuse it again. I'll try a test
on this tomorrow. Otherwise,
I'll need to set up some type of macro to select and delete all of the
Links, so I can rebuild them
or trigger a manual update, or something... Thoughts?
Kent
On Aug 24, 8:05 am, Kent wrote:
Regarding moving the quotes, in our examples the structure looks like:
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} "
However, after updating the field (F9) it would sometimes move the
closing quote
following the filename to behind the bookmark, like:
"{INCLUDETEXT "File_of_Includes bookmarkforUC_1"} "
When I started getting the Invalide filename, I noticed that actually
smashed the
bookmark into the end of the filename, so there was no space between
them. I'll try
again this morning.
Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)? I guess I assumed that it wouldn't resolve
and include the
file/bookmark if the condition wasn't met first. But, it's probably
resolving inside-out with
the filename and bookmark first, then determining if it should display
only if the
conditions are true. I'm just speculating based on my earlier life as
a programmer
...a LONG time ago. This is a bit of stretch for me now, but like I
said, I'm trying to keep
it simple for those that I'll be leaving it with.
May be I could pull the filename from a document variable, but it
would
probably have the same problem once it resolved the filename. Worth
checking...
Kent
On Aug 24, 2:56 am, Peter Jamieson
wrote:
I just wish this SOB would react consistently so I could address the
issues appropriately.
IKWYM.
It keeps failing on the
Filename, when
I wasn't changing anything
If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e.g.
caching it locally etc.).
You may be abe to do something with macropod's discovery that you can
use something like
{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}
to get Word to resolve the INCLUDETEXT fields completely as it goes along.
it keeps repositioning where the quotes
are being position (behind
the Macro reference"
I lost you on this one, sorry...
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.
But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.
Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.
Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term...
Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...
Thanks for the advise.
Kent
On Aug 23, 3:26 am, Peter Jamieson
wrote:
that I could put all of the fragments into one separate document, with
bookmarks for
each piece.
I probably should have spelled that out.
I wasn't crazy about having to maintain 2 different
documents
No, it's a pain.
By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Yes, I didn't get this at first as this was not the result in Word 2007
and I wondered if it only worked in Word 2003, but in fact I'd only
checked an IF with nothing except an INCLUDETEXT in the result, i.e.
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1}" ""}
(which does not show the hyperlink behaviour) rather than
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
(which does).
Something to bear in mind if you hadn't noticed that you'd left a space
in there!
Another thing worth mentioning at this point is that even with the
original approach, the hyperlink is still "in the document" - you can
check by using VBA to look at Activedocument.Hyperlinks.Count and
.Follow ing the appropriate link. The trouble is that the UI doesn't
provide anything that can follow the link, and even inserting the "Open
Hyperlink" command into the appropriate context menu does not appear to
work. So a macro-based solution may be an option, although I cannot
provide you with a good starting point.
Otherwise, you /may/ be able to improve your current solution by using
using line breaks (shift-enter) rather than paragraph breaks in the
included document.
AFAICR there was quite a lengthy discussion about this type of problem
in this group sometime in 2008, involving macropod and various others. I
haven't been able to find it again and I can't remember whether or not
it was conclusive, but it might be worth having a look on Google groups.
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.
At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each

...

read more »- Hide quoted text -

- Show quoted text -


  #13   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Walter Briscoe Walter Briscoe is offline
external usenet poster
 
Posts: 42
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

In message
s.com of Mon, 24 Aug 2009 21:18:07 in microsoft.public.word.mailmerge.f
ields, Kent writes
Peter,


[snip]

INCLUDETEXT... I
cleaned them up, and figured out a way to point them to the right
location
using a Hyperlink as part of a SET statement to assign the path to a
variable,
which I then reference within my IncludeText. I put the details in a
Thread over
on Microsoft's site where you were responding to some related
questions on
INCLUDETEXT.


[snip]

I don't know how I missed this interesting thread until 31 Aug 2009!

Please give URL referencing "... a Thread over on Microsoft's site ..."
--
Walter Briscoe
  #14   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)

Have a look for an old conversation in the
microsoft.public.word.docmanagement newsgroup titled "INCLUDETEXT and
virtual path" that started on 04 Jan 2008.

Peter Jamieson

http://tips.pjmsn.me.uk

Walter Briscoe wrote:
In message
s.com of Mon, 24 Aug 2009 21:18:07 in microsoft.public.word.mailmerge.f
ields, Kent writes
Peter,


[snip]

INCLUDETEXT... I
cleaned them up, and figured out a way to point them to the right
location
using a Hyperlink as part of a SET statement to assign the path to a
variable,
which I then reference within my IncludeText. I put the details in a
Thread over
on Microsoft's site where you were responding to some related
questions on
INCLUDETEXT.


[snip]

I don't know how I missed this interesting thread until 31 Aug 2009!

Please give URL referencing "... a Thread over on Microsoft's site ..."

  #15   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

On Aug 30, 5:25*am, Peter Jamieson
wrote:
Thanks for posting back.

I would dearly love to pass this example back to the people at Microsoft
(if I could), who I am pretty sure now have the mindset that anyone
trying to do anything of this general nature should be coding it with
.NET and possibly VSTO. /Why/ anyone images that that is either easier
or more secure - particularly when you have to deal with more than one
version of Word - than overhauling the field code system so that it
behaves in a *more predictable and useful way is actually beyond me.

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
I tested it out, using the INCLUDETEXT "DocProperty includefile"
bookmark. I used macropod's script to figure out what I'd need to do.
The Filename/p \\..\\includefile didn't really work, but the autoexec
macro did, but I still had problems with the LINKs weren't updating
consistently. Then when I moved it to a Sharepoint to test how others
would access it, I was able to modify the DocProperty so it would
work. However, when I tried to build in the steps that a novice would
need to do in order to manage this if they needed to move it to their
local machine, I ran to even more issues. Most of which I was able to
get around, but it got fairly painful... Then after I got it working
(sort of) then everytime I'd refresh the document, the LINKs would
drive me crazy. Sometimes even just opening the document clean, the
LINKs would be screwed up.


So, I went back to square one, with my original context.
{ 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..." "" } *-- I figured out two things.


1) After you copy in the Hyperlink into the middle of the text, you
may need to replace the descriptive text for the Link, and reset the
style as a hyperlink. Then select it and update, then toggle to
verify.
2) Readers can see the hyperlink, but it doesn't present with the CTRL-
click to follow it. You just need to right-click, then "Toggle Field
Codes" then they can CTRL-click on the hyperlink. In essence, if the
main document is on one level, the Hyperlink within the IF is down one
level.


It's not quite as clean as being able to follow the link from the top
level, but it doesn't require a bunch of additional coding, extra
include files, or having to rely on what someone else may do with the
include files, or rely on the inconsistency of Word itself....


Best of luck,
Kent


On Aug 25, 2:22 am, Peter Jamieson
wrote:
re. the bullets/numbering, I don't have any more suggestions right now..


re. the INCLUDETEXT thing, you can (rather fortuitously) implement a
"relative addressing" scheme using the { FILENAME \p } field as the
base, e.g. to construct the path of a file in the same folder oas the
including file, use


"{ FILENAME \p }\\..\\includedfilename.doc"


macropod expanded this and wrote it up at


http://www.wopr.com/index.php?showto...70027&#entry67...


I would guess that you can do a


{ SET includedfilepath "{ FILENAME \p }\\..\\includedfilename.doc" }
then
{ INCLUDEFILE "{ includedfilepath }" bookmark }


or something similar.


Peter Jamieson


http://tips.pjmsn.me.uk


Kent wrote:
Peter,
I figured out why I was having problems with the Filename. I thought
it was
the format, but was actually the external Links that the INCLUDETEXT
was
building. Initially when I tested this approach, I was in a higher-
level folder, but
I copied the file and the Incldue file into a new folder, so it broke
the links. Or, it
got confused, since I had tried it out on probably 10 different
slightly different
formats, between running Updates, and making Adjustments, Word had
10+
different links for the same bookmark, and same section of
INCLUDETEXT... I
cleaned them up, and figured out a way to point them to the right
location
using a Hyperlink as part of a SET statement to assign the path to a
variable,
which I then reference within my IncludeText. I put the details in a
Thread over
on Microsoft's site where you were responding to some related
questions on
INCLUDETEXT.
I still have 2 outstanding issues with it, that I can probably just
live with for now...
1) Bulleting/sub-bullets are still hit and miss. It was interesting
that a given bookmark
could be at one bullet level, and contain several sub-bullets, and
maintain numbering of
the sub-bullets when it was included in the main document. The only
problem is that main
bullet doesn't show for some reason, probably because Word is confused
by the mixed
styles. I can split it so I have an Include for the main bullet and
another for the sub-bullets,
and that seems to work a little better, but then the first sub-bullet
doesn't show a number.
2) I'm a bit concerned about all of the external Links that Word is
generating. I'll need to
experiment with this to see what I need to do when I move it to
another folder, like when
I'm ready for others to access it on SharePoint. I'm not sure if I can
simply use my Set
Hyperlink approach, and then when I Select All - F9 if it will replace
them all or if it will
just add to the existing ones, and confuse it again. I'll try a test
on this tomorrow. Otherwise,
I'll need to set up some type of macro to select and delete all of the
Links, so I can rebuild them
or trigger a manual update, or something... Thoughts?
Kent
On Aug 24, 8:05 am, Kent wrote:
Regarding moving the quotes, in our examples the structure looks like:
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} "
However, after updating the field (F9) it would sometimes move the
closing quote
following the filename to behind the bookmark, like:
"{INCLUDETEXT "File_of_Includes bookmarkforUC_1"} "
When I started getting the Invalide filename, I noticed that actually
smashed the
bookmark into the end of the filename, so there was no space between
them. I'll try
again this morning.
Is there an order of precedence occuring when you execute the update
(F9 - e.g.
Left-to-Right, inside-out)? I guess I assumed that it wouldn't resolve
and include the
file/bookmark if the condition wasn't met first. But, it's probably
resolving inside-out with
the filename and bookmark first, then determining if it should display
only if the
conditions are true. I'm just speculating based on my earlier life as
a programmer
...a LONG time ago. This is a bit of stretch for me now, but like I
said, I'm trying to keep
it simple for those that I'll be leaving it with.
May be I could pull the filename from a document variable, but it
would
probably have the same problem once it resolved the filename. Worth
checking...
Kent
On Aug 24, 2:56 am, Peter Jamieson
wrote:
* I just wish this SOB would react consistently so I could address the
* issues appropriately.
IKWYM.
* It keeps failing on the
* Filename, when
* I wasn't changing anything
If you are using exactly the same filename for all the includes, I
suppose this is likely to be something to do with what Word does exactly
when it has loads of INCLUDETEXTs loading stuff from the same file. Does
it open the file once? Open multiple copies? Keep it open? Have a timing
problem? It has never been obvious and nor have I tried to use a monitor
to find out. But Word 2007 is far more likely to have problems in this
area as it seems to do a lot more stuff whenever it opens a file (e..g.
caching it locally etc.).
You may be abe to do something with macropod's discovery that you can
use something like
{IF {INCLUDETEXT {IF TRUE "the pathname"}} {INCLUDETEXT {IF TRUE
"the pathname"}}}
to get Word to resolve the INCLUDETEXT fields completely as it goes along.
* it keeps repositioning where the quotes
* are being position (behind
* the Macro reference"
I lost you on this one, sorry...
Peter Jamieson
http://tips.pjmsn.me.uk
Kent wrote:
Apparently the extra space was dumb luck. I didn't think it would
matter, since it's
part of the True-Text for the IF.
But, now I can't figure out what's going on. It keeps failing on the
Filename, when
I wasn't changing anything, other than the bullet structure. But after
running the CTRL-A, F9
to update all of the fields, it keeps repositioning where the quotes
are being position (behind
the Macro reference". I also wasn't including the '.doc' but now
trying it to fix this latest issue...
I just wish this SOB would react consistently so I could address the
issues appropriately.
Part of it may be self-inflicted, since I'm using 2007, but saving it
as 97-2003 compliant, which
may be injecting other issues... Problem is that most of the readers
most likely still have 2003.
Also, I'm trying to use minimal macros / VBA coding, since the folks
that I'll be leaving this with
are not coders, and I don't want to be married to this long term....
Tomorrow's another day... Hoping I can fix this latest issue on a
fresh pot of coffee in the morning...
*Thanks for the advise.
Kent
On Aug 23, 3:26 am, Peter Jamieson
wrote:


...

read more »- Hide quoted text -

- Show quoted text -


Yeah, the folks that I'll be leaving this with manage multiple process
documents, and that's all they do. When I showed them what little I
have in there for the IF and drop-downs, they were somewhat concerned
about being able to understand it. Now they understand Network
technology (switches, routers, etc.), since they work in that
environment, so I wouldn't classify them as techno-phobes, but
software logic is not there thing.

What's disappointing is that even the features that were provided
INCLUDETEXT, referencing other variables, etc. seem to have only been
given a cursory test at the top level. It doesn't appear to have been
tested with any expectation of nesting functions within other
functions. And it seems that the HYPERLINK function has some other
undocumented behaviors, especially when trying to use it resolve the
path and filename from another variable.

I'd be happy to have this thread forwarded to MS, but I'm not sure
what to do about it. Nor, do I have much time to deal with it, since
I'm a couple of weeks behind schedule now that I've been playing with
these other options. Let me know if there's something else I should do
along this line.

Regards,
Kent

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
Word 2003 cursor control in complex scripts - logical vs visual Robert Purdy Microsoft Word Help 3 July 5th 09 04:39 AM
Complex Table of Contents in Work 2003 Alaska_Word_novice[_2_] New Users 2 July 15th 08 09:56 PM
Set up of complex, multi-part documents? WORD 2007 tadopolis New Users 2 March 12th 08 05:53 PM
Word 2003 Installed a Complex Scripts Option Marilyn Microsoft Word Help 1 September 2nd 06 12:12 AM
WORD 2003 Complex Replace Problem DJB Scarlets Microsoft Word Help 1 July 7th 06 11:50 AM


All times are GMT +1. The time now is 12:56 AM.

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"