the screen.
Hope this helps.
services on a paid consulting basis.
Post by Ro bDoug,
Thanks for the feedback. We took your idea with respect to the table,
and used parts of your code from the supplied link and came up with a
solution. There is one small problem with our code that we hope that you
may have a work around for. When the userbox is loaded on top of our
Word document, we can't scroll down the document, or see the sentences
loading into the document until we close the userbox. The sentences do
end up appearing where we wish, however, being able to watch them appear,
and having the ability to scroll the document would be helpful. Below is
a copy of the code we are using.
Private Sub CommandButton1_Click()
match = False
keyword = keybox.Text
Set sourcedoc =
Documents.Open(FileName:="c:\National\Keyword\Keyword.doc")
For i = 1 To sourcedoc.Tables(1).Rows.Count
Set myitem = sourcedoc.Tables(1).Cell(i - 1, 1).Range
myitem.End = myitem.End - 1
If keyword = myitem.Text Then
match = True
For j = 1 To sourcedoc.Tables(1).Cell(i - 1,
2).Range.Paragraphs.Count
Set myitem = sourcedoc.Tables(1).Cell(i - 1,
2).Range.Paragraphs(j).Range
myitem.End = myitem.End - 1
cboKeyword.AddItem myitem.Text
Next j
End If
Next i
If match = True Then
cboKeyword.Value = "Click for list of matching sentences."
Else
cboKeyword.Value = "No matches found, please try another keyword."
End If
End Sub
Private Sub CommandButton2_Click()
report = cboKeyword.Value
insert = txtNum.Text
Application.ScreenUpdating = False
If insert = 1 Then
ThisDocument.Bookmarks("Def1").Range.Text = report
End If
If insert = 2 Then
ThisDocument.Bookmarks("Def2").Range.Text = report
End If
If insert = 3 Then
ThisDocument.Bookmarks("Def3").Range.Text = report
End If
If insert = 4 Then
ThisDocument.Bookmarks("Def4").Range.Text = report
End If
If insert = 5 Then
ThisDocument.Bookmarks("Def5").Range.Text = report
End If
If insert = 6 Then
ThisDocument.Bookmarks("Def6").Range.Text = report
End If
If insert = 7 Then
ThisDocument.Bookmarks("Def7").Range.Text = report
End If
If insert = 8 Then
ThisDocument.Bookmarks("Def8").Range.Text = report
End If
If insert = 9 Then
ThisDocument.Bookmarks("Def9").Range.Text = report
End If
If insert = 10 Then
ThisDocument.Bookmarks("Def10").Range.Text = report
End If
If insert = 11 Then
ThisDocument.Bookmarks("Def11").Range.Text = report
End If
If insert = 12 Then
ThisDocument.Bookmarks("Def12").Range.Text = report
End If
If insert = 13 Then
ThisDocument.Bookmarks("Def13").Range.Text = report
End If
If insert = 14 Then
ThisDocument.Bookmarks("Def14").Range.Text = report
End If
If insert = 15 Then
ThisDocument.Bookmarks("Def15").Range.Text = report
End If
If insert = 16 Then
ThisDocument.Bookmarks("Def16").Range.Text = report
End If
If insert = 17 Then
ThisDocument.Bookmarks("Def17").Range.Text = report
End If
If insert = 18 Then
ThisDocument.Bookmarks("Def18").Range.Text = report
End If
If insert = 19 Then
ThisDocument.Bookmarks("Def19").Range.Text = report
End If
If insert = 20 Then
ThisDocument.Bookmarks("Def20").Range.Text = report
End If
If insert = 21 Then
ThisDocument.Bookmarks("Def21").Range.Text = report
End If
If insert = 22 Then
ThisDocument.Bookmarks("Def22").Range.Text = report
End If
If insert = 23 Then
ThisDocument.Bookmarks("Def23").Range.Text = report
End If
If insert = 24 Then
ThisDocument.Bookmarks("Def24").Range.Text = report
End If
If insert = 25 Then
ThisDocument.Bookmarks("Def25").Range.Text = report
End If
If insert = 26 Then
ThisDocument.Bookmarks("Def26").Range.Text = report
End If
If insert = 27 Then
ThisDocument.Bookmarks("Def27").Range.Text = report
End If
If insert = 28 Then
ThisDocument.Bookmarks("Def28").Range.Text = report
End If
If insert = 29 Then
ThisDocument.Bookmarks("Def29").Range.Text = report
End If
If insert = 30 Then
ThisDocument.Bookmarks("Def30").Range.Text = report
End If
If insert = 31 Then
ThisDocument.Bookmarks("Def31").Range.Text = report
End If
If insert = 32 Then
ThisDocument.Bookmarks("Def32").Range.Text = report
End If
If insert = 33 Then
ThisDocument.Bookmarks("Def33").Range.Text = report
End If
If insert = 34 Then
ThisDocument.Bookmarks("Def34").Range.Text = report
End If
If insert = 35 Then
ThisDocument.Bookmarks("Def35").Range.Text = report
End If
If insert = 36 Then
ThisDocument.Bookmarks("Def36").Range.Text = report
End If
If insert = 37 Then
ThisDocument.Bookmarks("Def37").Range.Text = report
End If
If insert = 38 Then
ThisDocument.Bookmarks("Def38").Range.Text = report
End If
If insert = 39 Then
ThisDocument.Bookmarks("Def39").Range.Text = report
End If
If insert = 40 Then
ThisDocument.Bookmarks("Def40").Range.Text = report
End If
If insert = 41 Then
ThisDocument.Bookmarks("Def41").Range.Text = report
End If
If insert = 42 Then
ThisDocument.Bookmarks("Def42").Range.Text = report
End If
If insert = 43 Then
ThisDocument.Bookmarks("Def43").Range.Text = report
End If
If insert = 44 Then
ThisDocument.Bookmarks("Def44").Range.Text = report
End If
If insert = 45 Then
ThisDocument.Bookmarks("Def45").Range.Text = report
End If
If insert = 46 Then
ThisDocument.Bookmarks("Def46").Range.Text = report
End If
If insert = 47 Then
ThisDocument.Bookmarks("Def47").Range.Text = report
End If
If insert = 48 Then
ThisDocument.Bookmarks("Def48").Range.Text = report
End If
If insert = 49 Then
ThisDocument.Bookmarks("Man1").Range.Text = report
End If
If insert = 50 Then
ThisDocument.Bookmarks("Man2").Range.Text = report
End If
If insert = 51 Then
ThisDocument.Bookmarks("Man3").Range.Text = report
End If
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton3_Click()
End
End Sub
Private Sub UserForm_Initialize()
Dim sourcedoc As Document, keyword As String, i As Single, j As Single,
myitem As Range, match As Boolean, report As Variant, insert As Integer
End Sub
Thanks,
Rob
Post by Doug Robbins - Word MVP1. I would store the keywords and the associated sentences in a two
column table in a Word document. Each keyword would occupy a single
cell in the first column of the table and the sentences associated with
each keyword would be separate paragraphs in the cell in Column two
adjacent to the keyword.
2. I would have a userform that contained a combobox and a listbox.
The combobox would be loaded with the keywords when the userform is
activated and when a selection is made in the combobox, the listbox
would be populated with the sentences associated with that keyword. The
user would then select the sentence that they wanted to use and on
clicking on a command button on the userform, the sentence would be
inserted into the document.
In the posts in the following link, you will find a routine that I created
for some one else that populates a second combobox with data pertaining to
the item selected in another combobox.
http://groups.google.com/group/microsoft.public.word.vba.userforms/browse_thread/thread/f3f67faa8297aa66/bf86a5657fe2c34e?q=Doug+Robbins&rnum=7#bf86a5657fe2c34e
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Post by Ro bThanks Charles,
I did look at the AutoText option, however, with multiple sentences
related to a single keyword, it won't really serve my purpose.
Any other suggestions?
Post by Charles KenyonLook into AutoText and AutoText list fields.
--
Charles Kenyon
Word New User FAQ & Web Directory: http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
Post by Ro bHello,
My job includes writing long deficiency lists for use in reports to
our customers. I find that I am constantly having to write / type
the same deficiencies sentences over and over.
What I am in search of is an add-in for Word 2000 that would allow me
to type a keyword, that prompts a drop down with all of the different
deficiency sentences that include that keyword. By selecting the
sentence that I want from that list, it would be inserted into my
document.
I understand that it would take some setup time on my part, however,
I believe that it would ultimately save me much time.
Any and all input is appreciated.