for display only
Big Blue Interactive The Corner Forum  
Back to the Corner

Archived Thread

Microsoft Word VBA/Macro question - repost

tbonfig : 12/12/2017 4:28 pm
I had posted a thread on December 7 to which giants#1 and Banks responded but the thread seemed to die, so I'm doing a quick repost to see if I can get some more assistance.

If this is a violation or pestering anyone, I'll happily delete:

I review a lot of legal documents and just discussed a macro that I've customized to highlight certain words different colors for easy scanning. This is pretty huge for me.

I also type up a lot of notes/agenda and have a system for identifying items as a question, a follow-up, or an issue. I applied the same principles of the highlight for this as a search/replace function and it is going to save me a ton of time.

But now I'm feeling greedy.

Anyone have any idea if there would be a way to create a macro to move text into another section on a word document? For example, when I type my notes, I do it by certain categories, let's say there are 5 categories. After I review the documents, I run my macro and it highlights what I have labeled as a question, follow-up or issue. Now I'm wondering if I could run a macro to take all the things that have been labeled as questions and regroup them somewhere else on the document, same with the follow-ups, etc.

This would save me an unquantifiable amount of time through the year, but I feel like it would be difficult to set up.

If it matters, when I type my notes, they're in bullet formatting.

Here was my second post:

Thanks in advance for the help everyone.

Okay, so the way I currently go through my process is that I look at various reports and type notes associated with those reports.

I started using a symbol as shorthand before typing the note to identify it in one of the three aforementioned categories: (i) Question; (ii) Follow-up; (iii) Issue (or Exclusion).

The way I have done this is that if the item needs to be follow-up on, I simply type: '[[' (without quotes). For questions, I type: '[' and exclusions: '{'.

Then I used to go through, do a find and replace with highlight to replace those symbols with the lead-in of QUESTION: FOLLOW-UP: or EXCLUSION: with various colors.

Now with my new macro, I don't need to do the find and replace, so it saves a good bit of time.

However, I thought it would be great if I could have the first page of my Notes template automatically aggregate a copy of every follow-up, exclusion or question.

Here is my current highlight/replace macro that I've been using:

Quote:

Sub Highlight_Knowledge_Green()
'
' Highlight_Knowledge_Green Macro
'
'Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long

'highlight knowledge
Options.DefaultHighlightColorIndex = wdGreen
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

vFindText = Array("knowledge", "knowledgeable")
vReplText = "^& "
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = False

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
Next i
End With

'Highlight Material
Options.DefaultHighlightColorIndex = wdYellow

vFindText = Array("material", "material adverse effect", "materially")
vReplText = "^& "
With Selection.Find
.Forward = True
.Wrap = wdFindContinue

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
Next i
End With

'Highlight Material Customer/Material Supplier/Material Contract
Options.DefaultHighlightColorIndex = wdRed

vFindText = Array("material customer", "material supplier", "material contract")
vReplText = "^& "
With Selection.Find
.Forward = True
.Wrap = wdFindContinue

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
Next i
End With

'Highlight Threat
Options.DefaultHighlightColorIndex = wdPink

vFindText = Array("threat", "threatened", "threatening")
vReplText = "^& "
With Selection.Find
.Forward = True
.Wrap = wdFindContinue

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
Next i
End With

End Sub


Attached is a sample template I just put together. You'll see under Legal and Financial review there is an example for one of each the three categories that I would ideally like to:
1. Hit my macro, have it convert into question/follow/exclusion
2. Hit the second macro to have it move those lines into one of the three categories on the top page


Tiny Upload hosting of Notes Template word doc - ( New Window )
Back to the Corner