Advertisement
Guest User

Untitled

a guest
Mar 11th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub SplitItalic()
  2.     Selection.HomeKey wdStory
  3.     With Selection.Find
  4.         .ClearFormatting
  5.         .ClearHitHighlight
  6.         .Text = ""
  7.         .Font.Italic = True
  8.         While (.Execute)
  9.             If Not Selection.Characters.First.Previous.Font.Italic And _
  10.                 Selection.Characters.First.Previous.Text Like "[! ,.:;?!-]" Then
  11.                 Selection.InsertBefore " "
  12.             ElseIf Not Selection.Characters.Last.Next.Font.Italic And _
  13.                 Selection.Characters.Last.Next.Text Like "[! ,.:;?!-]" Then
  14.                 Selection.InsertAfter " "
  15.             End If
  16.         Wend
  17.     End With
  18. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement