Big Blue Interactive The Corner Forum  
Back to the Corner
 

Archived Thread

NFT: Microsoft Word VBA/Macro question

tbonfig : 12/7/2017 2:47 pm
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.
if you can identify the text  
giants#1 : 12/7/2017 3:00 pm : link
I don't see why it would be difficult, though it's been a (long) while since I've used VBA. Can't you do some type of cut & paste:
Quote:


Me.theTextBox.Cut()

Me.theTextBox.Copy()

Me.theTextBox.Paste()


Link - ( New Window )
yea  
Banks : 12/7/2017 3:02 pm : link
I'd write it for you, but I'm currently at work. You could probably find the bulk of the code online
_  
Banks : 12/7/2017 3:07 pm : link
why don't you post an example of what you done and if time allows, one of us can guide you or write it. That way we can test it out on our end
Awesome  
tbonfig : 12/7/2017 3:45 pm : link
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 )
Morning guys  
tbonfig : 12/8/2017 9:41 am : link
Bumping this thread for banks or giants
Back to the Corner