PDA

View Full Version : WORD 365 URGENT HELP NEEDED!



goddesslady
07-11-2020, 05:13 AM
I have a 300 word document and I need to write code to do the following:


Underline every 10th word in the writing sample, excluding the header
Highlight every word in the writing sample that starts with a vowel in yellow
Highlight every word in the writing sample that ends with a vowel in blue
Highlight every word in the writing sample that both starts and ends with a vowel in green

gmaxey
07-11-2020, 07:10 AM
This looks like a homework assignment but in any case this forum is not a free code writing service. If you want to learn VBA, there are plenty of people here willing to help. To get you started:


Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "<[AEIOUaeiou]*>"
.MatchWildcards = True
While .Execute
oRng.Characters.First.HighlightColorIndex = wdYellow
oRng.Collapse wdCollapseEnd
Wend
End With
lbl_Exit:
Exit Sub
End Sub

goddesslady
07-11-2020, 07:35 AM
Thank you. What do you suggest I do? This is a test for a job I really need; They gave me 24 hours to complete it and I have 4.5 hours left. I have NO EXPERIENCE doing VBAs. I had a friend help me with the first question- he couldn't figure the rest out, so he sent me here.