当前位置:首页 > WPS文字 > 正文内容

WPS文字VBA中页脚从第*页开始

达叔8个月前 (12-14)WPS文字133

存下,暂时未测试

myPages = yms

strfield = "第" & "=PAGE+" & myPages & "页"

CodesLenth = VBA.Len(strfield)

PageLenth = Len(CStr(myPages))With pwrdname

'添加页脚页码

    Set wdRange = .Sections(1).Footers(wdHeaderFooterPrimary).Range

    wdRange.Text = strfield

    wdRange.SetRange 2, 2 + 4

   .Fields.Add Range:=wdRange, Type:=wdFieldEmpty, PreserveFormatting:=False

   EndRange = wdRange.Paragraphs(1).Range.End - 2

   wdRange.SetRange wdRange.Start - 1, EndRange

   .Fields.Add Range:=wdRange, Type:=wdFieldEmpty, PreserveFormatting:=False

   wdRange.Fields.Update

End With


版权声明:本文由WPS达师发布,如需转载请注明出处。