Office 2010/Word macros


Hi Steven,

I have a word project I need to get started and it involves macros searching a doc and if it meets a criteria, change it to X. For example, we use templates that have hidden text used as instructions and I want a macro to search the doc and remove it. I have a lot of different examples of this - changing blue boiler plate text to black, adding header/footer info or removing header/footer info. So, to get started, can you help me with a macro that searches a doc for hidden text and removes it. Also, any other books or websites that you think would be helpful to me.



Hi Chris,

The macro I have included below should do the trick for you:

Sub RemoveHiddenText()
Dim sView As Boolean
sView = ActiveWindow.View.ShowHiddenText
ActiveWindow.View.ShowHiddenText = True
With Selection.Find
.Text = ""
.Font.Hidden = True
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.View.ShowHiddenText = sView
End Sub


As for reference materials, I would suggest visiting some forums such as ExcelForums (they are not striclty for Excel and have Word threads as well) and even sticking with the Microsoft Support / Community sites.

If you need any help, please let me know!

Kind Regards,

Office 2010

All Answers

Answers by Expert:

Ask Experts


Steven Harris


I am proficient in all MS Office features, including but not limited to Visual Basic (Macros), Document Protection, Active-X Controls and Developer Features.


I have an extensive educational, vocational and business background extending over 12 years in information technology.

Association of Information Technology Professionals IEEE Computer Society Texas Professionals Texas Young Professionals Excel Developers Excel Blackbelts

Microsoft Certified Technology Specialist (MCTS) Program Microsoft Office Expert Program

©2017 All rights reserved.