2011-10-05 54 views
1

我正在寻找可以在文档中查找每种样式的文档文件的宏,并将其从任何文档(居中,对齐,右对齐)更改为左对齐。将文档中的所有样式更新为左对齐

我不想改变文本(除了作为副产品),但风格本身,所以一切都更新。

+1

您是否尝试录制宏,然后通过各种方式将其扩大到循环? – Fionnuala

回答

2

由于Remou,我试图与它的工作,这似乎工作:

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