Bernadette
09-18-2012, 10:55 AM
Hello again,
I recently posted a thread asking for help with a macro. The code worked beautifully but now there is a change in the requirement. When the text is pasted a green bold bracket needs to appear after the pasted text.
example:
[2] You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. (moved from para. [1]) You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.) You can also format text directly by using the other controls on the Home tab.
Here is the code from the previous macro:
Sub CopyAndStrikeThrough()
Dim StrSrc As String, Rng As Range
With Selection
Set Rng = .Range
.Start = .Words.First.Start
.End = .Words.Last.End
.Collapse wdCollapseStart
StrSrc = "(moved from para. " & _
.Paragraphs(1).Range.ListFormat.ListString & ") "
.InsertBefore StrSrc 'inserts the specified text before selected text
.Font.Color = 5287936 'dark green colour
.Font.Bold = True
Rng.Start = .Start
Rng.Copy
.Text = vbNullString
Rng.Font.Strikethrough = True
Rng.Font.ColorIndex = wdAuto
End With
End Sub
Thank you so much for your help!
Bernie
I recently posted a thread asking for help with a macro. The code worked beautifully but now there is a change in the requirement. When the text is pasted a green bold bracket needs to appear after the pasted text.
example:
[2] You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. (moved from para. [1]) You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.) You can also format text directly by using the other controls on the Home tab.
Here is the code from the previous macro:
Sub CopyAndStrikeThrough()
Dim StrSrc As String, Rng As Range
With Selection
Set Rng = .Range
.Start = .Words.First.Start
.End = .Words.Last.End
.Collapse wdCollapseStart
StrSrc = "(moved from para. " & _
.Paragraphs(1).Range.ListFormat.ListString & ") "
.InsertBefore StrSrc 'inserts the specified text before selected text
.Font.Color = 5287936 'dark green colour
.Font.Bold = True
Rng.Start = .Start
Rng.Copy
.Text = vbNullString
Rng.Font.Strikethrough = True
Rng.Font.ColorIndex = wdAuto
End With
End Sub
Thank you so much for your help!
Bernie