开发者

Update all styles in doc to left-align

开发者 https://www.devze.com 2023-04-10 15:08 出处:网络
I am looking for a macro for word documents that will find every style in a document, and change it from whatever it is开发者_StackOverflow (centered, justified, right-align) to left-align.

I am looking for a macro for word documents that will find every style in a document, and change it from whatever it is开发者_StackOverflow (centered, justified, right-align) to left-align.

I don't want to change the text (except as a by-product), but the style itself so everything updates.


Thanks Remou, I tried working with it, and this seems to work:

Sub ChangeStyles()

Dim oSource As Document
Set oSource = ActiveDocument

For i = 1 To oSource.Styles.Count
' must check the style type as character style gives an error
If oSource.Styles(i).Type = wdStyleTypeParagraph Then
With ActiveDocument.Styles(i).ParagraphFormat
.Alignment = wdAlignParagraphLeft
End With
Else
End If
Next i

End Sub
0

精彩评论

暂无评论...
验证码 换一张
取 消