Dave T
12-19-2011, 11:55 PM
Hello All,
Rather than use 'track changes' to identify new/added text I manually use the following macro on the highlighted text:
Sub HighlightTextAdditions()
' Colours selected text violet with violet underline and light yellow shading
Dim rng As Range
Set rng = Selection.Range
' Only if text is selected
If Len(rng.Text) > 0 Then
rng.Font.ColorIndex = wdViolet
rng.Font.Underline = wdUnderlineSingle
rng.Shading.BackgroundPatternColor = wdColorLightYellow
End If
End Sub
I also use a version of the above to highlight text that is to be deleted.
Greg Maxey helped me out with a macro that steps through the text and deletes any text with strikethrough.
http://www.vbaexpress.com/forum/showthread.php?t=39296
When the text additions have been approved I need a macro that will remove the background pattern shading, return the text to its default colour and remove the underline.
I have some code which does this however there is a problem when hyperlinks are encountered within the text additions.
The macros I have tried using remove the underline from the hyperlink as well (something I do not want it to do)
Sub RemoveTextAdditionsColour()
' Removes formatting applied by 'ColourTextAdditions' macro
Dim rng As Range
Set rng = Selection.Range
' Only if text is selected
If Len(rng.Text) > 0 Then
rng.Font.ColorIndex = wdAuto
rng.Font.Underline = wdUnderlineNone
rng.Font.Shading.Texture = wdTextureNone
rng.Font.Shading.ForegroundPatternColor = wdColorAutomatic
rng.Font.Shading.BackgroundPatternColor = wdColorAutomatic
End If
Call ApplyHyperlinkStyle
End Sub
Once again I have tried to use another example of code from Greg Maxey, and whilst this works it removes the hyperlink from the first and last letters of the hyper-linked text
Sub ApplyHyperlinkStyle()
Dim oLink As Hyperlink
For Each oLink In ActiveDocument.Hyperlinks
oLink.Range.Style = "Hyperlink"
Next oLink
End Sub
Does anyone have any solution for removing the formatting of my text additions macro, but only remove the background shading and retain the blue hyperlink font colour with its underline.
Any help would be appreciated.
Regards,
Dave T
Rather than use 'track changes' to identify new/added text I manually use the following macro on the highlighted text:
Sub HighlightTextAdditions()
' Colours selected text violet with violet underline and light yellow shading
Dim rng As Range
Set rng = Selection.Range
' Only if text is selected
If Len(rng.Text) > 0 Then
rng.Font.ColorIndex = wdViolet
rng.Font.Underline = wdUnderlineSingle
rng.Shading.BackgroundPatternColor = wdColorLightYellow
End If
End Sub
I also use a version of the above to highlight text that is to be deleted.
Greg Maxey helped me out with a macro that steps through the text and deletes any text with strikethrough.
http://www.vbaexpress.com/forum/showthread.php?t=39296
When the text additions have been approved I need a macro that will remove the background pattern shading, return the text to its default colour and remove the underline.
I have some code which does this however there is a problem when hyperlinks are encountered within the text additions.
The macros I have tried using remove the underline from the hyperlink as well (something I do not want it to do)
Sub RemoveTextAdditionsColour()
' Removes formatting applied by 'ColourTextAdditions' macro
Dim rng As Range
Set rng = Selection.Range
' Only if text is selected
If Len(rng.Text) > 0 Then
rng.Font.ColorIndex = wdAuto
rng.Font.Underline = wdUnderlineNone
rng.Font.Shading.Texture = wdTextureNone
rng.Font.Shading.ForegroundPatternColor = wdColorAutomatic
rng.Font.Shading.BackgroundPatternColor = wdColorAutomatic
End If
Call ApplyHyperlinkStyle
End Sub
Once again I have tried to use another example of code from Greg Maxey, and whilst this works it removes the hyperlink from the first and last letters of the hyper-linked text
Sub ApplyHyperlinkStyle()
Dim oLink As Hyperlink
For Each oLink In ActiveDocument.Hyperlinks
oLink.Range.Style = "Hyperlink"
Next oLink
End Sub
Does anyone have any solution for removing the formatting of my text additions macro, but only remove the background shading and retain the blue hyperlink font colour with its underline.
Any help would be appreciated.
Regards,
Dave T