PDA

View Full Version : [SOLVED:] Cataloging blocks of text



KennStewart
03-22-2018, 08:06 AM
For some time I have been wondering if there is a way to label blocks of contract text in the background then run a vba macro to list those labels in a separate report to catalog the contents of the document.
the benefit would be to quickly view what versions of contract terms are found in each document so that when laws change we can have a master catalog to locate text blocks that need amending. After amending the text block we could give it a new version label and update our master catalog. Is this possible?

gmaxey
03-22-2018, 12:43 PM
Not sure what you are trying to do. However, if I had say 100 document templates that each contained text related to a law, statute, or regulation subject to change, then I would probably have the text in a content control and when I created a document based on that template I would use VBA to insert the text from a separate building block library of various laws, statutes and regulations that concerned my business. As long as you keep the library updated then your documents are updated.

macropod
03-23-2018, 11:32 PM
You could use a 'parent' document with all the standard 'blocks', with INCLUDETEXT fields in all its 'child' documents to link the content. That way, any change in the 'parent' document will update all its 'child' documents. Be warned, however, that maintaining such links to existing contracts, for example, can have serious legal implications if you go changing their content retrospectively. To avoid that, you should break the links in such 'child' documents as soon as the contract terms are agreed. See: https://support.office.com/en-us/article/field-codes-includetext-field-1c34d6d6-0de3-4b5c-916a-2ff950fb629e

KennStewart
03-26-2018, 06:58 AM
Thank you both. I guess what I am trying to do is assign a unique name to each block of text "behind the scenes" and then be able to run a report to list each unique name contained in the document. This would allow me to monitor which document has which clauses.

gmaxey
03-26-2018, 10:14 AM
If that is all you want to do then you could wrap your blocks of text in richtext CCs and use the tag property to define that CC as a monitored CC and ID the text block
E.g., your CC tags would look something like this "Monitor|USC 9.1.1", "Monitor|CA 123" etc.

Run this code:


Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey, http://gregmaxey.com/word_tips.html, 3/26/2018
Dim oCC As ContentControl
Dim arrTagParts() As String
Dim strReport As String
For Each oCC In ActiveDocument.ContentControls
arrTagParts = Split(oCC.Tag, "|")
If UBound(arrTagParts) > 0 Then
If arrTagParts(0) = "Monitor" Then
strReport = strReport & arrTagParts(1) & vbCr
End If
End If
Next oCC
MsgBox strReport
lbl_Exit:
Exit Sub
End Sub

KennStewart
03-27-2018, 06:34 AM
That sounds great. Thanks. I will give that a try in a couple days when I get back to my home office.
Thanks much
Kenn

KennStewart
03-27-2018, 07:51 PM
Thank you!! That worked great.
Would you happen to know how I could get that to print out the list of tags either at the bottom of the document or on a separate word doc?
Thanks again.

U DA MAN!

KennStewart
03-27-2018, 07:54 PM
PS- Thanks for your service in the Navy!

gmaxey
03-28-2018, 04:38 AM
PS- Thanks for your service in the Navy!
Replace MsgBox with ActiveDocument.Range.InsertAfter & vbcr

KennStewart
03-29-2018, 02:18 PM
That worked great. Thanks much!
Kenn