dragonruler
02-10-2009, 08:40 AM
Ok so this what I have so far. I want to search the current open document for highlighted text then I want to hide that text with the given color. Right now Im just trying to get it to work, Ill deal with the form stuff later. So I can find the highlighted text and remove the color or change the highlighted color but I cant seem to figure out how to hide that text.
Private Sub CommandButton1_Click()
Const wdTurquoise = 3
Const wdRed = 5
Const wdBrightGreen = 4
Const wdNoHighlight = 0
Const wdBlue = 2
'Set objWord = CreateObject("Word.Application")
'objWord.Visible = True
'Set objDoc = objWord.Documents.Open("C:\Hidden.doc")
'Set objRange = objDoc.Range
Set objRange = ActiveDocument.Range
objRange.Find.Highlight = True
objRange.Find.Forward = True
Do While objRange.Find.Execute
If objRange.HighlightColorIndex = wdBrightGreen Then
'CANT USE THE NEXT STATEMENT FOR OBVIOUS REASONS
' But it gets the point across
objRange.Visible = False
End If
intPosition = objRange.End
objRange.Start = intPosition
Loop
ActiveWindow.ActivePane.View.Type = wdPrintView
End Sub
Private Sub CommandButton1_Click()
Const wdTurquoise = 3
Const wdRed = 5
Const wdBrightGreen = 4
Const wdNoHighlight = 0
Const wdBlue = 2
'Set objWord = CreateObject("Word.Application")
'objWord.Visible = True
'Set objDoc = objWord.Documents.Open("C:\Hidden.doc")
'Set objRange = objDoc.Range
Set objRange = ActiveDocument.Range
objRange.Find.Highlight = True
objRange.Find.Forward = True
Do While objRange.Find.Execute
If objRange.HighlightColorIndex = wdBrightGreen Then
'CANT USE THE NEXT STATEMENT FOR OBVIOUS REASONS
' But it gets the point across
objRange.Visible = False
End If
intPosition = objRange.End
objRange.Start = intPosition
Loop
ActiveWindow.ActivePane.View.Type = wdPrintView
End Sub