A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need to nest HYPERLINK within a complex IF (Word 2003/2007)



 
 
Thread Tools Display Modes
  #1  
Old August 21st, 2009, 11:09 PM posted to microsoft.public.word.mailmerge.fields
Kent[_3_]
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  
Old August 22nd, 2009, 01:37 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
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  
Old August 23rd, 2009, 04:18 AM posted to microsoft.public.word.mailmerge.fields
Kent[_3_]
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  
Old August 23rd, 2009, 09:26 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
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  
Old August 24th, 2009, 04:22 AM posted to microsoft.public.word.mailmerge.fields
Kent[_3_]
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  
Old August 24th, 2009, 08:56 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
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  
Old August 24th, 2009, 02:05 PM posted to microsoft.public.word.mailmerge.fields
Kent[_3_]
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  
Old August 24th, 2009, 03:15 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
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  
Old August 25th, 2009, 05:18 AM posted to microsoft.public.word.mailmerge.fields
Kent[_3_]
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  
Old August 25th, 2009, 08:22 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
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 -


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.