VBA 相关

更新目录,按range更新

Sub mulu1()
ActiveDocument.Fields(1).Update
Selection.SetRange Start:=177, End:=552
Selection.Font.Name = "黑体"
With Selection.Font
.Size = 20
.SizeBi = 20
.TextColor = RGB(13, 146, 163)
End With
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 8
.LineSpacing = 80
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 80
.DisableLineHeightGrid = 0
.ReadingOrder = wdReadingOrderLtr
.AutoAdjustRightIndent = -1
.WidowControl = 0
.KeepWithNext = 0
.KeepTogether = 0
.PageBreakBefore = 0
.FarEastLineBreakControl = -1
.WordWrap = -1
.HangingPunctuation = -1
.HalfWidthPunctuationOnTopOfLine = 0
.AddSpaceBetweenFarEastAndAlpha = -1
.AddSpaceBetweenFarEastAndDigit = -1
.BaseLineAlignment = wdBaselineAlignAuto
End With
ActiveWindow.ActivePane.VerticalPercentScrolled = 14
RecentFiles.Add Document:=ThisDocument.FullName, ReadOnly:=False
ActiveDocument.Save
End Sub

 

 

更新目录,按照区域选择对象进行更新(Python代码,win32com)

word = Dispatch('Word.Application')
word.Visible = 0 # 后台运行
word.DisplayAlerts = 0
my_docx = word.Documents.Open(docx_path)
for f in my_docx.Fields:
f.Update()
f.Select()
w = word.Selection
w.Font.Name = "黑体"
w.Font.Size = 20
w.Font.SizeBi = 20
w.Font.TextColor = RGB(13, 146, 163)
w.ParagraphFormat.LineSpacingRule = 4
w.ParagraphFormat.LineSpacing = 9
w.ParagraphFormat.LineSpacing = 90
my_docx.Save()
if not preview:
my_docx.PrintOut()
my_docx.Close() # 关闭 word 文档
# word.Quit() # 关闭 office

 

 

 

《VBA 相关》为 九城 原创,创作不易!转载请注明出处!感谢!
文章地址:https://blog.minkse.cn/vba-%e7%9b%b8%e5%85%b3%e4%bb%a3%e7%a0%81%e8%ae%b0%e5%bd%95/
暂无评论

发送评论 编辑评论

|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇