當前位置:編程學習大全網 - 源碼下載 - word2007,為什麽用VBA設置取消首行縮進,但實際運行後沒有效果?

word2007,為什麽用VBA設置取消首行縮進,但實際運行後沒有效果?

測試,首行縮進2個字符,代碼為:

Sub?宏2()

'

'?宏2?宏

'

'

With?Selection.ParagraphFormat

.LeftIndent?=?CentimetersToPoints(0)

.RightIndent?=?CentimetersToPoints(0)

.SpaceBefore?=?0

.SpaceBeforeAuto?=?False

.SpaceAfter?=?0

.SpaceAfterAuto?=?False

.LineSpacingRule?=?wdLineSpaceSingle

.Alignment?=?wdAlignParagraphJustify

.WidowControl?=?False

.KeepWithNext?=?False

.KeepTogether?=?False

.PageBreakBefore?=?False

.NoLineNumber?=?False

.Hyphenation?=?True

.FirstLineIndent?=?CentimetersToPoints(0.35)

.OutlineLevel?=?wdOutlineLevelBodyText

.CharacterUnitLeftIndent?=?0

.CharacterUnitRightIndent?=?0

.CharacterUnitFirstLineIndent?=?2

.LineUnitBefore?=?0

.LineUnitAfter?=?0

.MirrorIndents?=?False

.TextboxTightWrap?=?wdTightNone

.AutoAdjustRightIndent?=?True

.DisableLineHeightGrid?=?False

.FarEastLineBreakControl?=?True

.WordWrap?=?True

.HangingPunctuation?=?True

.HalfWidthPunctuationOnTopOfLine?=?False

.AddSpaceBetweenFarEastAndAlpha?=?True

.AddSpaceBetweenFarEastAndDigit?=?True

.BaseLineAlignment?=?wdBaselineAlignAuto

End?With

End?Sub

主要代碼貌似是.FirstLineIndent = CentimetersToPoints(0.35),由厘米轉為磅,網上介紹和字符的字號有關,但更改字號大小後,錄制的縮進2個字符仍然是 以上代碼。運行後沒有問題。

測試將代碼如果只保留.FirstLineIndent = CentimetersToPoints(0.35),刪掉其他語句,實際效果就不是想要的結果(字號大時,縮進沒有達到2個字符)。

檢查發現,以上代碼可以簡化為:——測試正常

Sub?宏3()

'

'?宏3?宏

'

'

With?Selection.ParagraphFormat

.CharacterUnitFirstLineIndent?=?2

End?With

End?Sub

  • 上一篇:壹建教材2023版什麽時候出版
  • 下一篇:最簡明易懂的思維導圖軟件Xmind教程
  • copyright 2024編程學習大全網