Skip to content

Instantly share code, notes, and snippets.

@hedgejanuary
Created May 5, 2020 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hedgejanuary/efc93717de2322d22524e7ad94b41c05 to your computer and use it in GitHub Desktop.
Save hedgejanuary/efc93717de2322d22524e7ad94b41c05 to your computer and use it in GitHub Desktop.
Word macro to apply styles in the selected range.
Sub newsFormat()
With Selection
.Paragraphs(1).Style = "見出し 1"
.Sentences(1).Bold = True
.Paragraphs(2).Range.InsertBefore Text:="●"
.Paragraphs(2).Style = "見出し 2"
.Sentences(2).Bold = True
.Paragraphs(3).Style = "行間詰め"
.Paragraphs(3).LeftIndent = MillimetersToPoints(millimeters:=5)
.Paragraphs(4).Style = "行間詰め"
.Paragraphs(4).LeftIndent = MillimetersToPoints(millimeters:=5)
.Paragraphs(4).Range.InsertBefore Text:="<"
ActiveDocument.Range(Start:=.Paragraphs(4).Range.End - 1).InsertBefore Text:=">"
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment