If you use Character Styles, and in particular if you maintain three styles “csB”, “csI” and “csStrikeThrough”, you may find these three macros handy. And yes, they could be streamlined to make use of a slave function.
I spend 95% or more of my time off-line, and prepare texts offline for posting.
With these macros I can do the lounge editing off-line (the {b} and {/b} switches) and see the effect on my text.
I know too that I could make the {b} and {/b} switches hidden so that they wouldn’t clutter my view, but then I’d always be wondering whether I’d used these new-fangled macros or my Shift-Ctrl-B combinations to make the text appear bold.
I could too augment these with LoungeHide and LoungeCode. All the more reason for a slave function ...
Cheers
Chris
Code: Select all
Sub LoungeItalics()
Dim rng As Range
Set rng = Selection.Range
Dim lngStart As Long
lngStart = rng.Start
Dim strText As String
strText = "[i]" & Selection.Range.Text & "[/i]"
Selection.TypeText Text:=strText
rng.End = Selection.End
rng.Select
rng.Style = ActiveDocument.Styles("csI")
End Sub
Sub LoungeBold()
Dim rng As Range
Set rng = Selection.Range
Dim lngStart As Long
lngStart = rng.Start
Dim strText As String
strText = "[b]" & Selection.Range.Text & "[/b]"
Selection.TypeText Text:=strText
rng.End = Selection.End
rng.Select
rng.Style = ActiveDocument.Styles("csB")
End Sub
Sub LoungeStrikethrough()
Dim rng As Range
Set rng = Selection.Range
Dim lngStart As Long
lngStart = rng.Start
Dim strText As String
strText = "[s]" & Selection.Range.Text & "[/s]"
Selection.TypeText Text:=strText
rng.End = Selection.End
rng.Select
rng.Style = ActiveDocument.Styles("csStrikeThrough")
End Sub