#1
|
|||
|
|||
How to generate an open items list automatically?
At my previous employer, word had a tool where you could have it automatically generate a new word document that would list out all language/text that was in between open and closed brackets. So, instead of having to go through the doc, bracket by bracket, it would auto pull them into a list for easy tracking. The thing is, I cannot find any resource online for this, and was hoping someone on Reddit is familiar with a word tool that does similar stuff. |
#2
|
||||
|
||||
Quote:
For the problem you've described, and assuming your 'brackets' are parentheses, try: Code:
Sub Demo() Application.ScreenUpdating = False Dim Rng As Range, StrOut As String With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "\(*\)" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True End With Do While .Find.Execute With .Duplicate Set Rng = .Characters.Last Do While InStr(2, .Text, "(", vbTextCompare) > 0 .MoveEndUntil ")", wdForward .End = .End + 1 .Start = .Start + 1 .MoveStartUntil "(", wdForward Set Rng = .Characters.Last Loop End With .End = Rng.End StrOut = StrOut & vbCr & .Text .Collapse wdCollapseEnd Loop End With Documents.Add ActiveDocument.Range.InsertAfter StrOut Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA or Macros to generate List | asante_za | Excel Programming | 1 | 09-29-2017 09:51 AM |
Automatically generate formulas from just the row numbers (auto insert the column) | knewman | Excel | 14 | 04-25-2017 11:54 PM |
List of 30 items with Logos, transition the 30 items | blexann | PowerPoint | 1 | 11-03-2016 08:55 AM |
Automatically generate PDF from saved word doc | JamesHusband | Word | 3 | 06-07-2014 08:30 AM |
Outlook 2007 Saved sent items list only holds the last ten items | david.peake | Outlook | 0 | 06-01-2010 07:27 PM |