View Single Post
 
Old 05-20-2020, 06:16 AM
MrBill51 MrBill51 is offline Windows 10 Office 2010
Novice
 
Join Date: May 2020
Posts: 2
MrBill51 is on a distinguished road
Default

Thanks for your suggestion. It didn't work, but I managed to tweak it and now it works great, without the need to create any styles. Here's the code:


Sub FixNovelFormat()

'Fix the first-line indentation of Scrivener Word output file

Set myRange = ActiveDocument.Content

'Remove indentation from third paragraph below the word "CHAPTER"
With myRange.Find
.Text = "CHAPTER"
While .Execute
myRange.Collapse Direction:=wdCollapseStart
myRange.Move Unit:=wdParagraph, Count:=3
myRange.ParagraphFormat.FirstLineIndent = InchesToPoints(0)
myRange.Collapse wdCollapseEnd
Wend
End With

'Remove indentation from the paragraph below the hashtag
Set myRange = ActiveDocument.Content

With myRange.Find
.Text = "#"
While .Execute
myRange.Collapse Direction:=wdCollapseStart
myRange.Move Unit:=wdParagraph, Count:=1
myRange.ParagraphFormat.FirstLineIndent = InchesToPoints(0)
myRange.Collapse wdCollapseEnd
Wend
End With
End Sub
Reply With Quote