charlesweir

Restyling Bibliography in VBA

Apr 23rd, 2020
743
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub RestyleBibliography()
  2. '
  3. ' Changes the style of text within the 'Bibliography' bookmark to 'Bibliography'.
  4. '
  5.    ' If there's no Bibliography style or bookmark, skip this (though actually I think Bibliography may be a built-in style)
  6.    On Error GoTo ExitSub
  7.     BibliographyStyle = ActiveDocument.Styles("Bibliography")
  8.     With ActiveDocument.Bookmarks("Bibliography").Range
  9.         .Select
  10.         Selection.ClearParagraphDirectFormatting
  11.         .style = BibliographyStyle
  12.     End With
  13.  
  14. ExitSub:
  15.     On Error GoTo -1 ' VBA Magic to reset error handling
  16. End Sub
RAW Paste Data