《如何使用vba给文件夹中的word文档批量修改页眉页脚和水印》由会员分享,可在线阅读,更多相关《如何使用vba给文件夹中的word文档批量修改页眉页脚和水印(1页珍藏版)》请在金锄头文库上搜索。
如何给文件夹中的 word 文档批量修改页眉页脚和水印Private Sub CommandButton1_Click()Dim doc As Document, ph$, f$ph = ThisDocument.Path & “新建文件夹“f = Dir(ph & “*.doc*“)Do While f “Set doc = Documents.Open(ph & f, Visible:=False)doc.Sections(1).Headers(1).Range.Text = “课本知识要点汇总“With doc.Sections(1).Headers(1).Shapes.AddPicture(ph & “水印图片.png“, 0, 1).Height = CentimetersToPoints(21).Width = CentimetersToPoints(51).RelativeHorizontalPosition = 0: .Left = wdShapeCenter.RelativeVerticalPosition = 0: .Top = wdShapeCenterEnd Withdoc.Close -1, 1f = DirLoopMsgBox “操作完毕并保存!“End Sub