| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
Jay Freedman
Guest
Posts: n/a
|
On Tue, 3 Jun 2008 16:06:00 -0700, hjneedshelp
<(E-Mail Removed)> 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. |
|
||
|
||||
|
hjneedshelp
Guest
Posts: n/a
|
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 > <(E-Mail Removed)> 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. > |
|
||
|
||||
|
Gregory K. Maxey
Guest
Posts: n/a
|
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("TX").Value Case Is = "North Carolina" ActiveDocument.Tables(1).Cell(1, 2).Range.Text = ActiveDocument.AttachedTemplate.AutoTextEntries("NC").Value Case Is = "California" ActiveDocument.Tables(1).Cell(1, 2).Range.Text = ActiveDocument.AttachedTemplate.AutoTextEntries("CA").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 >> <(E-Mail Removed)> 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. |
|
||
|
||||
|
Suzanne S. Barnhill
Guest
Posts: n/a
|
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)... >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("TX").Value > Case Is = "North Carolina" > ActiveDocument.Tables(1).Cell(1, 2).Range.Text = > ActiveDocument.AttachedTemplate.AutoTextEntries("NC").Value > Case Is = "California" > ActiveDocument.Tables(1).Cell(1, 2).Range.Text = > ActiveDocument.AttachedTemplate.AutoTextEntries("CA").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 >>> <(E-Mail Removed)> 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. > > > |
|
||
|
||||
|
hjneedshelp
Guest
Posts: n/a
|
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("TX").Value > Case Is = "North Carolina" > ActiveDocument.Tables(1).Cell(1, 2).Range.Text = > ActiveDocument.AttachedTemplate.AutoTextEntries("NC").Value > Case Is = "California" > ActiveDocument.Tables(1).Cell(1, 2).Range.Text = > ActiveDocument.AttachedTemplate.AutoTextEntries("CA").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 > >> <(E-Mail Removed)> 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. > > > |
|
||
|
||||
|
hjneedshelp
Guest
Posts: n/a
|
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" <(E-Mail Removed)> wrote in > message news:(E-Mail Removed)... > >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("TX").Value > > Case Is = "North Carolina" > > ActiveDocument.Tables(1).Cell(1, 2).Range.Text = > > ActiveDocument.AttachedTemplate.AutoTextEntries("NC").Value > > Case Is = "California" > > ActiveDocument.Tables(1).Cell(1, 2).Range.Text = > > ActiveDocument.AttachedTemplate.AutoTextEntries("CA").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 > >>> <(E-Mail Removed)> 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. > > > > > > > > > |
|
||
|
||||
|
Gregory K. Maxey
Guest
Posts: n/a
|
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("CA1").Value ActiveDocument.Tables(1).Cell(2, 2).Range.Text = ActiveDocument.AttachedTemplate.AutoTextEntries("CA2").Value ActiveDocument.Tables(1).Cell(3, 2).Range.Text = ActiveDocument.AttachedTemplate.AutoTextEntries("CA3").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 >>>> <(E-Mail Removed)> 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. |
|
||
|
||||
|
hjneedshelp
Guest
Posts: n/a
|
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("CA1").Value > ActiveDocument.Tables(1).Cell(2, 2).Range.Text = > ActiveDocument.AttachedTemplate.AutoTextEntries("CA2").Value > ActiveDocument.Tables(1).Cell(3, 2).Range.Text = > ActiveDocument.AttachedTemplate.AutoTextEntries("CA3").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 > >>>> <(E-Mail Removed)> 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. > > > |
|
||
|
||||
|
Gregory K. Maxey
Guest
Posts: n/a
|
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" <(E-Mail Removed)> wrote in message news:0D1A085D-1071-424A-89F8-(E-Mail Removed)... > 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("CA1").Value >> ActiveDocument.Tables(1).Cell(2, 2).Range.Text = >> ActiveDocument.AttachedTemplate.AutoTextEntries("CA2").Value >> ActiveDocument.Tables(1).Cell(3, 2).Range.Text = >> ActiveDocument.AttachedTemplate.AutoTextEntries("CA3").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 >> >>>> <(E-Mail Removed)> 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. >> >> >> |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to apply a conditional Select distinct (or conditional Where onduplicated cell values in a column) | Jamie | Microsoft Access Queries | 3 | 2nd Oct 2009 07:39 PM |
| Conditional Formatting > 3 conditions & referencing cell values | =?Utf-8?B?RGlja2llIFdvcnRvbg==?= | Microsoft Excel Programming | 3 | 13th Jun 2007 12:13 PM |
| Conditional Formatting referencing other Worksheets | mcarnold@gmail.com | Microsoft Excel Discussion | 1 | 18th Dec 2006 11:26 PM |
| IIF referencing both conditional parts regardless of condition? | Steven Nagy | Microsoft VB .NET | 5 | 13th Sep 2006 02:22 PM |
| referencing conditional formatting | David Turner | Microsoft Excel Misc | 2 | 24th Oct 2003 09:05 AM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




