Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
hjneedshelp hjneedshelp is offline
external usenet poster
 
Posts: 13
Default Conditional referencing/If values

Does Word have the capability (like Excel) of returning a specific value €śy€ť
based on a what the user defines as value €śx€ť?

I have a worksheet where specific topics are listed in Column 1 for each
row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement set by the
end-user from a drop-down list.

For example, if the user selects €śJones€ť from a drop-down list, only
Kitchen/Bedroom/Living Room-related info, etc., will appear based on the
€śJones€ť requirement. If the user selects €śMitchell,€ť then a whole new set of
text will appear in each row.

Thank you for any assistance you can provide.

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Conditional referencing/If values

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific value “y”
based on a what the user defines as value “x”?

I have a worksheet where specific topics are listed in Column 1 for each
row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement set by the
end-user from a drop-down list.

For example, if the user selects “Jones” from a drop-down list, only
Kitchen/Bedroom/Living Room-related info, etc., will appear based on the
“Jones” requirement. If the user selects “Mitchell,” then a whole new set of
text will appear in each row.

Thank you for any assistance you can provide.


See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
hjneedshelp hjneedshelp is offline
external usenet poster
 
Posts: 13
Default Conditional referencing/If values

Hello,
Thank you for the link. It is helpful but doesn't exactly solve my problem.
If I just want to reference simple word items, the instructions would be
fine - instead, I want to reference more complex data - short paragraphs of
information that are either housed within the same document or a separate
document.

Perhaps I shouldn't have used "conditional" in the subject line - it's more
of a lookup table. So if a user inputs "Texas," the column will populate
information related to that state. May I do that in Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific value €śy€ť
based on a what the user defines as value €śx€ť?

I have a worksheet where specific topics are listed in Column 1 for each
row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement set by the
end-user from a drop-down list.

For example, if the user selects €śJones€ť from a drop-down list, only
Kitchen/Bedroom/Living Room-related info, etc., will appear based on the
€śJones€ť requirement. If the user selects €śMitchell,€ť then a whole new set of
text will appear in each row.

Thank you for any assistance you can provide.


See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Gregory K. Maxey Gregory K. Maxey is offline
external usenet poster
 
Posts: 17
Default Conditional referencing/If values

I think that Jay was simpy trying to show you how to catch fish rather than
handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field. You
then use vba to determine what was selected and then put some text in your
table column based on that selection.

For example you could store a few facts about Texas in and AutoText entry
named "TX" and some facts about other states in other aptly named AT entries
and then populate your table cell like so:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "Texas"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("T X").Value
Case Is = "North Carolina"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("N C").Value
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A").Value
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either housed
within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the column
will populate information related to that state. May I do that in
Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1 for
each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list, only
Kitchen/Bedroom/Living Room-related info, etc., will appear based
on the "Jones" requirement. If the user selects "Mitchell," then a
whole new set of text will appear in each row.

Thank you for any assistance you can provide.


See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default Conditional referencing/If values

In that case, though, an AutoTextList field might serve the purpose;
http://word.mvps.org/FAQs/TblsFldsFms/AutoTextList.htm.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"Gregory K. Maxey" wrote in
message ...
I think that Jay was simpy trying to show you how to catch fish rather than
handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field. You
then use vba to determine what was selected and then put some text in your
table column based on that selection.

For example you could store a few facts about Texas in and AutoText entry
named "TX" and some facts about other states in other aptly named AT
entries and then populate your table cell like so:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "Texas"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("T X").Value
Case Is = "North Carolina"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("N C").Value
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A").Value
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either housed
within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the column
will populate information related to that state. May I do that in
Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1 for
each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list, only
Kitchen/Bedroom/Living Room-related info, etc., will appear based
on the "Jones" requirement. If the user selects "Mitchell," then a
whole new set of text will appear in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.








  #6   Report Post  
Posted to microsoft.public.word.docmanagement
hjneedshelp hjneedshelp is offline
external usenet poster
 
Posts: 13
Default Conditional referencing/If values

Thank you. I appreciate your help. I'm all for learning how to fish. My
situation is just a bit more complicated. Thank you, anyway. I'm sure I
will use the information you and Jay shared in the future, if not now.



"Gregory K. Maxey" wrote:

I think that Jay was simpy trying to show you how to catch fish rather than
handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field. You
then use vba to determine what was selected and then put some text in your
table column based on that selection.

For example you could store a few facts about Texas in and AutoText entry
named "TX" and some facts about other states in other aptly named AT entries
and then populate your table cell like so:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "Texas"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("T X").Value
Case Is = "North Carolina"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("N C").Value
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A").Value
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either housed
within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the column
will populate information related to that state. May I do that in
Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1 for
each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list, only
Kitchen/Bedroom/Living Room-related info, etc., will appear based
on the "Jones" requirement. If the user selects "Mitchell," then a
whole new set of text will appear in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.




  #7   Report Post  
Posted to microsoft.public.word.docmanagement
hjneedshelp hjneedshelp is offline
external usenet poster
 
Posts: 13
Default Conditional referencing/If values

Hi Suzanne,

This is a very good reference. It seems the AutoTextList option is too
narrow of a solution for what I need. I'll try to ask again, in hopes that
there is a solution...

Envison a worksheet at the top of which is a drop-down list that lists all
50 states.
Below this drop-down list is a two-column matrix.

In the matrix, the first column contains row headings (Topic 1, Topic 2,
Topic 3...), the second column has a column heading of "State Distinctions"
and is where I want information to pop up - so if the user selects
"California" from the drop-down list, only California-specific information
would show in Topic 1, Topic 2, Topic 3, etc. The CA-specific information in
each topic is not the same (so an autotext for "CA" does not work).

See how this looks, below:

Select State from Drop-down

State Distinctions
Topic 1 state specific info for Topic 1
Topic 2 state specific info for Topic 2
Topic 3 state specific info for Topic 3

The only way I think it might work is to do an "IF" formula; e.g., If cell A
(the drop-down cell) = California; then cell A3 (Topic 1) = "reference to
the document/cell that contains the correct information". Each "Topic"
cell, however, would have to have a unique and LONG string of values (one
if/then for each state)... unless I can do an If/then range. If this is
possible, I need some guidance. I've tried a bunch of IF statements, and
nothing is working as of yet.

Thank you, again.

"Suzanne S. Barnhill" wrote:

In that case, though, an AutoTextList field might serve the purpose;
http://word.mvps.org/FAQs/TblsFldsFms/AutoTextList.htm.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"Gregory K. Maxey" wrote in
message ...
I think that Jay was simpy trying to show you how to catch fish rather than
handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field. You
then use vba to determine what was selected and then put some text in your
table column based on that selection.

For example you could store a few facts about Texas in and AutoText entry
named "TX" and some facts about other states in other aptly named AT
entries and then populate your table cell like so:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "Texas"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("T X").Value
Case Is = "North Carolina"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("N C").Value
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A").Value
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either housed
within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the column
will populate information related to that state. May I do that in
Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1 for
each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list, only
Kitchen/Bedroom/Living Room-related info, etc., will appear based
on the "Jones" requirement. If the user selects "Mitchell," then a
whole new set of text will appear in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.







  #8   Report Post  
Posted to microsoft.public.word.docmanagement
Gregory K. Maxey Gregory K. Maxey is offline
external usenet poster
 
Posts: 17
Default Conditional referencing/If values

Once again, the offerings that Jay, Suzanne, and I have offered here are
simply suggestion on "how" to do something and not a complete solution to
your specific problem.

I think you may have dismissed the AutoText idea too quickly. Again, I
don't know the full scope of your problem, but if you need information for
topics 1, 2 and 3 then I suppose that you could have an AutoText CA1, CA2
and CA3 and then adapt to:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A1").Value
ActiveDocument.Tables(1).Cell(2, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A2").Value
ActiveDocument.Tables(1).Cell(3, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A3").Value
Case Is = "Texas"
etc.
End Select
End Sub

Again, that is just a suggestion showing how it could be done. I would
probably pull the information from an existing source such as another table
in the existing document, a table in a separate document, a database, etc.
rather than develop the individual AutoText entries.






hjneedshelp wrote:
Thank you. I appreciate your help. I'm all for learning how to
fish. My situation is just a bit more complicated. Thank you,
anyway. I'm sure I will use the information you and Jay shared in
the future, if not now.



"Gregory K. Maxey" wrote:

I think that Jay was simpy trying to show you how to catch fish
rather than handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field.
You then use vba to determine what was selected and then put some
text in your table column based on that selection.

For example you could store a few facts about Texas in and AutoText
entry named "TX" and some facts about other states in other aptly
named AT entries and then populate your table cell like so:

End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either
housed within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the
column will populate information related to that state. May I do
that in Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1
for each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list,
only Kitchen/Bedroom/Living Room-related info, etc., will appear
based on the "Jones" requirement. If the user selects
"Mitchell," then a whole new set of text will appear in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.



  #9   Report Post  
Posted to microsoft.public.word.docmanagement
hjneedshelp hjneedshelp is offline
external usenet poster
 
Posts: 13
Default Conditional referencing/If values

Hi Gregory. I understand they are suggestions, and I am not asking anyone to
do my work for me. I'm just at a loss to accomplish what I want.

You write at the end of your message, "I would
probably pull the information from an existing source such as another table
in the existing document, a table in a separate document, a database, etc.
rather than develop the individual AutoText entries."

That is what I want to do! But, I can't figure out the formula to help me do
that.
Unless I'm not understanding the AutoText feature correctly, I am thinking
that that option won't work, because I need that state-specific information
to be easily maintained and edited by other users. If the info were to
remain static, AutoText could be a viable option, although it seems,
time-consuming. I just want to reference specific cells in another table or
document dependent upon what state the user selects in the drop-down list
(actually, more than reference - it has to show the actual text).

I apologize for any frustration I'm causing everyone.
"Gregory K. Maxey" wrote:

Once again, the offerings that Jay, Suzanne, and I have offered here are
simply suggestion on "how" to do something and not a complete solution to
your specific problem.

I think you may have dismissed the AutoText idea too quickly. Again, I
don't know the full scope of your problem, but if you need information for
topics 1, 2 and 3 then I suppose that you could have an AutoText CA1, CA2
and CA3 and then adapt to:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A1").Value
ActiveDocument.Tables(1).Cell(2, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A2").Value
ActiveDocument.Tables(1).Cell(3, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A3").Value
Case Is = "Texas"
etc.
End Select
End Sub

Again, that is just a suggestion showing how it could be done. I would
probably pull the information from an existing source such as another table
in the existing document, a table in a separate document, a database, etc.
rather than develop the individual AutoText entries.






hjneedshelp wrote:
Thank you. I appreciate your help. I'm all for learning how to
fish. My situation is just a bit more complicated. Thank you,
anyway. I'm sure I will use the information you and Jay shared in
the future, if not now.



"Gregory K. Maxey" wrote:

I think that Jay was simpy trying to show you how to catch fish
rather than handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field.
You then use vba to determine what was selected and then put some
text in your table column based on that selection.

For example you could store a few facts about Texas in and AutoText
entry named "TX" and some facts about other states in other aptly
named AT entries and then populate your table cell like so:

End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either
housed within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the
column will populate information related to that state. May I do
that in Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1
for each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list,
only Kitchen/Bedroom/Living Room-related info, etc., will appear
based on the "Jones" requirement. If the user selects
"Mitchell," then a whole new set of text will appear in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.




  #10   Report Post  
Posted to microsoft.public.word.docmanagement
Gregory K. Maxey Gregory K. Maxey is offline
external usenet poster
 
Posts: 17
Default Conditional referencing/If values

Hi hjneedshelp,

At this point it would be nice to have a name ;-)

I am not confused. I think that I know what you are trying to do. To be
honest, I don't really know if any of my suggestions worth a hoot or suited
for your needs. I know what I said before, but if I was really going to do
what you are trying to do, then I would probably want to create some sort of
XML file containing the data and then pull the informatin from there.
Unfortunately when it comes to working with XML I am in the same boat as you
you are. I know what I would like to do but I don't know how to do it. ;-).

That said, and unless I could find someone to step me though and spoon feed
me an XML solution I would suppose I would make do with something like this.
Bear in mind that this is just on the fly and may and probably does needs
some refinements.

Let's say your current template is named "State Facts"

I would create a source file containing a single table 51 rows and say 5
columns. I would

State Name Point 1 Point 2 Point 3 Point 4
Point 5
Californai
Texas
North Carolina
etc.

of course they would be in order.

For this example the file is saved as "C:\Source.doc)

I would then use the following code to

1. Open the source.doc and extract the information into an array anytime I
open or create a new file based on State Facts template.
2. Use the data in the array to populate the table cell data.

Option Explicit
Private myArray(50, 4) As String
Sub AutoOpen()
GetData
End Sub

Sub AutoNew()
GetData
End Sub

Sub DDOnExit()
If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If
Dim oTbls As Word.Tables
Set oTbls = ActiveDocument.Tables
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
oTbls(1).Cell(1, 2).Range.Text = StripCellMarker(myArray(1, 1))
oTbls(1).Cell(2, 2).Range.Text = StripCellMarker(myArray(1, 2))
oTbls(1).Cell(3, 2).Range.Text = StripCellMarker(myArray(1, 3))
Case Is = "Texas"
oTbls(1).Cell(1, 2).Range.Text = StripCellMarker(myArray(2, 1))
oTbls(1).Cell(2, 2).Range.Text = StripCellMarker(myArray(2, 2))
oTbls(1).Cell(3, 2).Range.Text = StripCellMarker(myArray(2, 3))
Case Is = "North Carolina"
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

Function StripCellMarker(ByRef pStr As String) As String
StripCellMarker = Left(pStr, Len(pStr) - 2)
End Function

Sub GetData()
Dim oDoc As Word.Document
Dim i As Long
Dim j As Long
Set oDoc = Documents.Open(FileName:="C:\Source.doc", Visible:=False)
Dim oTbl As Word.Table
Set oTbl = oDoc.Tables(1)
For i = 0 To 50
For j = 0 To 4
myArray(i, j) = oTbl.Cell(i + 1, j + 1).Range.Text
Next j
Next i
oDoc.Close wdDoNotSaveChanges
End Sub



"hjneedshelp" wrote in message
...
Hi Gregory. I understand they are suggestions, and I am not asking anyone
to
do my work for me. I'm just at a loss to accomplish what I want.

You write at the end of your message, "I would
probably pull the information from an existing source such as another
table
in the existing document, a table in a separate document, a database, etc.
rather than develop the individual AutoText entries."

That is what I want to do! But, I can't figure out the formula to help me
do
that.
Unless I'm not understanding the AutoText feature correctly, I am thinking
that that option won't work, because I need that state-specific
information
to be easily maintained and edited by other users. If the info were to
remain static, AutoText could be a viable option, although it seems,
time-consuming. I just want to reference specific cells in another table
or
document dependent upon what state the user selects in the drop-down list
(actually, more than reference - it has to show the actual text).

I apologize for any frustration I'm causing everyone.
"Gregory K. Maxey" wrote:

Once again, the offerings that Jay, Suzanne, and I have offered here are
simply suggestion on "how" to do something and not a complete solution to
your specific problem.

I think you may have dismissed the AutoText idea too quickly. Again, I
don't know the full scope of your problem, but if you need information
for
topics 1, 2 and 3 then I suppose that you could have an AutoText CA1, CA2
and CA3 and then adapt to:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A1").Value
ActiveDocument.Tables(1).Cell(2, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A2").Value
ActiveDocument.Tables(1).Cell(3, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A3").Value
Case Is = "Texas"
etc.
End Select
End Sub

Again, that is just a suggestion showing how it could be done. I would
probably pull the information from an existing source such as another
table
in the existing document, a table in a separate document, a database,
etc.
rather than develop the individual AutoText entries.






hjneedshelp wrote:
Thank you. I appreciate your help. I'm all for learning how to
fish. My situation is just a bit more complicated. Thank you,
anyway. I'm sure I will use the information you and Jay shared in
the future, if not now.



"Gregory K. Maxey" wrote:

I think that Jay was simpy trying to show you how to catch fish
rather than handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field.
You then use vba to determine what was selected and then put some
text in your table column based on that selection.

For example you could store a few facts about Texas in and AutoText
entry named "TX" and some facts about other states in other aptly
named AT entries and then populate your table cell like so:

End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either
housed within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the
column will populate information related to that state. May I do
that in Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1
for each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list,
only Kitchen/Bedroom/Living Room-related info, etc., will appear
based on the "Jones" requirement. If the user selects
"Mitchell," then a whole new set of text will appear in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.








  #11   Report Post  
Posted to microsoft.public.word.docmanagement
hjneedshelp hjneedshelp is offline
external usenet poster
 
Posts: 13
Default Conditional referencing/If values

Hi Gregory (my name is Heather

Wow, I will work with your suggestion. I think you are right, though, based
on what I just read about XML... it seems like it would be the right way to
go. I'll have to investigate that further, too.

Thank you so much for your time and assistance. I've learned a lot, and I'm
sure the suggestions provided will help me solve this dilemma!

Thanks to you and all, again!
--Heather

"Gregory K. Maxey" wrote:

Hi hjneedshelp,

At this point it would be nice to have a name ;-)

I am not confused. I think that I know what you are trying to do. To be
honest, I don't really know if any of my suggestions worth a hoot or suited
for your needs. I know what I said before, but if I was really going to do
what you are trying to do, then I would probably want to create some sort of
XML file containing the data and then pull the informatin from there.
Unfortunately when it comes to working with XML I am in the same boat as you
you are. I know what I would like to do but I don't know how to do it. ;-).

That said, and unless I could find someone to step me though and spoon feed
me an XML solution I would suppose I would make do with something like this.
Bear in mind that this is just on the fly and may and probably does needs
some refinements.

Let's say your current template is named "State Facts"

I would create a source file containing a single table 51 rows and say 5
columns. I would

State Name Point 1 Point 2 Point 3 Point 4
Point 5
Californai
Texas
North Carolina
etc.

of course they would be in order.

For this example the file is saved as "C:\Source.doc)

I would then use the following code to

1. Open the source.doc and extract the information into an array anytime I
open or create a new file based on State Facts template.
2. Use the data in the array to populate the table cell data.

Option Explicit
Private myArray(50, 4) As String
Sub AutoOpen()
GetData
End Sub

Sub AutoNew()
GetData
End Sub

Sub DDOnExit()
If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If
Dim oTbls As Word.Tables
Set oTbls = ActiveDocument.Tables
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
oTbls(1).Cell(1, 2).Range.Text = StripCellMarker(myArray(1, 1))
oTbls(1).Cell(2, 2).Range.Text = StripCellMarker(myArray(1, 2))
oTbls(1).Cell(3, 2).Range.Text = StripCellMarker(myArray(1, 3))
Case Is = "Texas"
oTbls(1).Cell(1, 2).Range.Text = StripCellMarker(myArray(2, 1))
oTbls(1).Cell(2, 2).Range.Text = StripCellMarker(myArray(2, 2))
oTbls(1).Cell(3, 2).Range.Text = StripCellMarker(myArray(2, 3))
Case Is = "North Carolina"
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

Function StripCellMarker(ByRef pStr As String) As String
StripCellMarker = Left(pStr, Len(pStr) - 2)
End Function

Sub GetData()
Dim oDoc As Word.Document
Dim i As Long
Dim j As Long
Set oDoc = Documents.Open(FileName:="C:\Source.doc", Visible:=False)
Dim oTbl As Word.Table
Set oTbl = oDoc.Tables(1)
For i = 0 To 50
For j = 0 To 4
myArray(i, j) = oTbl.Cell(i + 1, j + 1).Range.Text
Next j
Next i
oDoc.Close wdDoNotSaveChanges
End Sub



"hjneedshelp" wrote in message
...
Hi Gregory. I understand they are suggestions, and I am not asking anyone
to
do my work for me. I'm just at a loss to accomplish what I want.

You write at the end of your message, "I would
probably pull the information from an existing source such as another
table
in the existing document, a table in a separate document, a database, etc.
rather than develop the individual AutoText entries."

That is what I want to do! But, I can't figure out the formula to help me
do
that.
Unless I'm not understanding the AutoText feature correctly, I am thinking
that that option won't work, because I need that state-specific
information
to be easily maintained and edited by other users. If the info were to
remain static, AutoText could be a viable option, although it seems,
time-consuming. I just want to reference specific cells in another table
or
document dependent upon what state the user selects in the drop-down list
(actually, more than reference - it has to show the actual text).

I apologize for any frustration I'm causing everyone.
"Gregory K. Maxey" wrote:

Once again, the offerings that Jay, Suzanne, and I have offered here are
simply suggestion on "how" to do something and not a complete solution to
your specific problem.

I think you may have dismissed the AutoText idea too quickly. Again, I
don't know the full scope of your problem, but if you need information
for
topics 1, 2 and 3 then I suppose that you could have an AutoText CA1, CA2
and CA3 and then adapt to:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A1").Value
ActiveDocument.Tables(1).Cell(2, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A2").Value
ActiveDocument.Tables(1).Cell(3, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A3").Value
Case Is = "Texas"
etc.
End Select
End Sub

Again, that is just a suggestion showing how it could be done. I would
probably pull the information from an existing source such as another
table
in the existing document, a table in a separate document, a database,
etc.
rather than develop the individual AutoText entries.






hjneedshelp wrote:
Thank you. I appreciate your help. I'm all for learning how to
fish. My situation is just a bit more complicated. Thank you,
anyway. I'm sure I will use the information you and Jay shared in
the future, if not now.



"Gregory K. Maxey" wrote:

I think that Jay was simpy trying to show you how to catch fish
rather than handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown field.
You then use vba to determine what was selected and then put some
text in your table column based on that selection.

For example you could store a few facts about Texas in and AutoText
entry named "TX" and some facts about other states in other aptly
named AT entries and then populate your table cell like so:

End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly solve my
problem. If I just want to reference simple word items, the
instructions would be fine - instead, I want to reference more
complex data - short paragraphs of information that are either
housed within the same document or a separate document.

Perhaps I shouldn't have used "conditional" in the subject line -
it's more of a lookup table. So if a user inputs "Texas," the
column will populate information related to that state. May I do
that in Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a specific
value "y" based on a what the user defines as value "x"?

I have a worksheet where specific topics are listed in Column 1
for each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets) that
corresponds to the row topic (e.g., Kitchen) AND to a requirement
set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down list,
only Kitchen/Bedroom/Living Room-related info, etc., will appear
based on the "Jones" requirement. If the user selects
"Mitchell," then a whole new set of text will appear in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.






  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Gregory K. Maxey Gregory K. Maxey is offline
external usenet poster
 
Posts: 17
Default Conditional referencing/If values

Ok Heather. Good luck.

hjneedshelp wrote:
Hi Gregory (my name is Heather

Wow, I will work with your suggestion. I think you are right,
though, based on what I just read about XML... it seems like it would
be the right way to go. I'll have to investigate that further, too.

Thank you so much for your time and assistance. I've learned a lot,
and I'm sure the suggestions provided will help me solve this dilemma!

Thanks to you and all, again!
--Heather

"Gregory K. Maxey" wrote:

Hi hjneedshelp,

At this point it would be nice to have a name ;-)

I am not confused. I think that I know what you are trying to do.
To be honest, I don't really know if any of my suggestions worth a
hoot or suited for your needs. I know what I said before, but if I
was really going to do what you are trying to do, then I would
probably want to create some sort of XML file containing the data
and then pull the informatin from there. Unfortunately when it comes
to working with XML I am in the same boat as you you are. I know
what I would like to do but I don't know how to do it. ;-).

That said, and unless I could find someone to step me though and
spoon feed me an XML solution I would suppose I would make do with
something like this. Bear in mind that this is just on the fly and
may and probably does needs some refinements.

Let's say your current template is named "State Facts"

I would create a source file containing a single table 51 rows and
say 5 columns. I would

State Name Point 1 Point 2 Point 3
Point 4 Point 5
Californai
Texas
North Carolina
etc.

of course they would be in order.

For this example the file is saved as "C:\Source.doc)

I would then use the following code to

1. Open the source.doc and extract the information into an array
anytime I open or create a new file based on State Facts template.
2. Use the data in the array to populate the table cell data.

Option Explicit
Private myArray(50, 4) As String
Sub AutoOpen()
GetData
End Sub

Sub AutoNew()
GetData
End Sub

Sub DDOnExit()
If ActiveDocument.ProtectionType wdNoProtection Then
ActiveDocument.Unprotect
End If
Dim oTbls As Word.Tables
Set oTbls = ActiveDocument.Tables
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
oTbls(1).Cell(1, 2).Range.Text = StripCellMarker(myArray(1, 1))
oTbls(1).Cell(2, 2).Range.Text = StripCellMarker(myArray(1, 2))
oTbls(1).Cell(3, 2).Range.Text = StripCellMarker(myArray(1, 3))
Case Is = "Texas"
oTbls(1).Cell(1, 2).Range.Text = StripCellMarker(myArray(2, 1))
oTbls(1).Cell(2, 2).Range.Text = StripCellMarker(myArray(2, 2))
oTbls(1).Cell(3, 2).Range.Text = StripCellMarker(myArray(2, 3))
Case Is = "North Carolina"
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

Function StripCellMarker(ByRef pStr As String) As String
StripCellMarker = Left(pStr, Len(pStr) - 2)
End Function

Sub GetData()
Dim oDoc As Word.Document
Dim i As Long
Dim j As Long
Set oDoc = Documents.Open(FileName:="C:\Source.doc", Visible:=False)
Dim oTbl As Word.Table
Set oTbl = oDoc.Tables(1)
For i = 0 To 50
For j = 0 To 4
myArray(i, j) = oTbl.Cell(i + 1, j + 1).Range.Text
Next j
Next i
oDoc.Close wdDoNotSaveChanges
End Sub



"hjneedshelp" wrote in
message ...
Hi Gregory. I understand they are suggestions, and I am not asking
anyone to
do my work for me. I'm just at a loss to accomplish what I want.

You write at the end of your message, "I would
probably pull the information from an existing source such as
another table
in the existing document, a table in a separate document, a
database, etc. rather than develop the individual AutoText entries."

That is what I want to do! But, I can't figure out the formula to
help me do
that.
Unless I'm not understanding the AutoText feature correctly, I am
thinking that that option won't work, because I need that
state-specific information
to be easily maintained and edited by other users. If the info
were to remain static, AutoText could be a viable option, although
it seems, time-consuming. I just want to reference specific cells
in another table or
document dependent upon what state the user selects in the
drop-down list (actually, more than reference - it has to show the
actual text).

I apologize for any frustration I'm causing everyone.
"Gregory K. Maxey" wrote:

Once again, the offerings that Jay, Suzanne, and I have offered
here are simply suggestion on "how" to do something and not a
complete solution to your specific problem.

I think you may have dismissed the AutoText idea too quickly.
Again, I don't know the full scope of your problem, but if you
need information for
topics 1, 2 and 3 then I suppose that you could have an AutoText
CA1, CA2 and CA3 and then adapt to:

Sub DDOnExit()
ActiveDocument.Unprotect
Select Case ActiveDocument.FormFields("Dropdown1").Result
Case Is = "California"
ActiveDocument.Tables(1).Cell(1, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A1").Value
ActiveDocument.Tables(1).Cell(2, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A2").Value
ActiveDocument.Tables(1).Cell(3, 2).Range.Text =
ActiveDocument.AttachedTemplate.AutoTextEntries("C A3").Value
Case Is = "Texas"
etc.
End Select
End Sub

Again, that is just a suggestion showing how it could be done. I
would probably pull the information from an existing source such
as another table
in the existing document, a table in a separate document, a
database, etc.
rather than develop the individual AutoText entries.






hjneedshelp wrote:
Thank you. I appreciate your help. I'm all for learning how to
fish. My situation is just a bit more complicated. Thank you,
anyway. I'm sure I will use the information you and Jay shared in
the future, if not now.



"Gregory K. Maxey" wrote:

I think that Jay was simpy trying to show you how to catch fish
rather than handing you the fish ;-)

The answer to your question is yes.

The user defines "x" by selecting a something from a dropdown
field. You then use vba to determine what was selected and then
put some text in your table column based on that selection.

For example you could store a few facts about Texas in and
AutoText entry named "TX" and some facts about other states in
other aptly named AT entries and then populate your table cell
like so:

End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


hjneedshelp wrote:
Hello,
Thank you for the link. It is helpful but doesn't exactly
solve my problem. If I just want to reference simple word
items, the instructions would be fine - instead, I want to
reference more complex data - short paragraphs of information
that are either housed within the same document or a separate
document.

Perhaps I shouldn't have used "conditional" in the subject line
- it's more of a lookup table. So if a user inputs "Texas," the
column will populate information related to that state. May I
do that in Word?

Thank you, again.

"Jay Freedman" wrote:

On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
wrote:

Does Word have the capability (like Excel) of returning a
specific value "y" based on a what the user defines as value
"x"?

I have a worksheet where specific topics are listed in Column
1 for each row, for example:

(Col 1)
Kitchen
Bedroom
Living Room
Basement

In Col 2, I only want text to appear (paragraphs or bullets)
that corresponds to the row topic (e.g., Kitchen) AND to a
requirement set by the end-user from a drop-down list.

For example, if the user selects "Jones" from a drop-down
list, only Kitchen/Bedroom/Living Room-related info, etc.,
will appear based on the "Jones" requirement. If the user
selects "Mitchell," then a whole new set of text will appear
in each row.

Thank you for any assistance you can provide.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.



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
Problem arises when ref bookmark is added in the header ,it does not take the modified values and displays the same old values divya Microsoft Word Help 2 July 6th 06 01:08 PM
Problem arises when ref bookmark is added in the header ,it does not take the modified values and displays the same old values divya Microsoft Word Help 0 July 6th 06 11:47 AM
Cannot get field values Crazy Macros Mailmerge 6 November 21st 05 06:37 PM
Conditional Slash Similar to Conditional Hyphen? Oliver St Quintin Page Layout 7 May 10th 05 09:41 PM
Linked values WillieWorstel Microsoft Word Help 1 November 26th 04 05:07 PM


All times are GMT +1. The time now is 08:51 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"