I have a food shopping list- one item per line. Some lines are formatted as hidden (but are still visible), some aren't. I'm trying to output the non hidden lines to a new document. The problem with my existing code is that it works about 50% of the time. The other 50%, it erases the non hidden text. I'm working in Word 2003.
VBA Code:
Sub ExportDisplay()
'
' ExportDisplay Macro
' Macro recorded 8/18/2020 by user
'
Selection.Find.ClearFormatting
Selection.Find.Font.Hidden = True
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveDocument.SaveAs FileName:="D:\food shopping.doc"
End Sub