word vba 插入页码 word vba 页码
发布日期:2020-09-26摘要:分了好多节的word通过VBA调出某一节的页码范围sub test ()istart = InputBox("输入你要打印的起始节")iEnd = InputBox("输入你要打印的结束节") 为了...
分了好多节的word通过VBA调出某一节的页码范围
sub test ()istart = InputBox("输入你要打印的起始节")iEnd = InputBox("输入你要打印的结束节") "为了方便搞了两个inputbox,你可以用一个,方法如下:"规定一个格式,然后用instr,left,right等得到起始和结束的节数Dim doc As DocumentDim rngDoc As RangeSet doc = ActiveDocumentSet rngDoc = doc.Range(Start:=doc.Paragraphs(istart).Range.Start, _End:=doc.Paragraphs(iEnd).Range.End)rngDoc.Selectdoc.PrintOut Range:=wdPrintSelectionSet rngDoc = NothingSet doc = Nothingend sub
word vba 怎么获取当前光标所在页码,并获取该页有多少行
Sub Macro2()Dim r, p, r0, p0, rr, ppp= Selection.Information(wdActiveEndPageNumber) "当前页码r= Selection.Information(wdFirstCharacterLineNumber) "当前行"数行数p0 = prr = rDoSelection.MoveDown Unit:=wdLine, Count:=1pp = Selection.Information(wdActiveEndPageNumber)r0 = Selection.Information(wdFirstCharacterLineNumber)If pp >p Then"退回原处Selection.MoveUp Unit:=wdLine, Count:=(rr - r + 1)Exit DoEnd IfIf rr = r0 Then"退回原处Selection.MoveUp Unit:=wdLine, Count:=(rr - r)Exit DoEnd Ifrr = r0LoopMsgBox "当前页码:" & p & vbCrLf & "本页总行数:" & rrEnd Sub 申请加悬赏分!!!
如何往大量A4纸上打印连续的页码?
以前对如何在Wod里从第三页开始插入页码,一直没有弄清楚今天终于明白了,现将其与大家分享: 1.光标移到第二页开头,点击“插入-分隔符-分节符类型-下一页-确定”。
2.光标移到第三页开头,重复步骤一。
3.光标移到第三页任意位置,点击“插入-页码-格式”,格式中选择“页码编排-起始页码”为1,点击“确定”退出。
4.双击第三页页码,出现页眉页脚工具栏,将“链接至前一个”按钮点击成灰色,点击“确定”退出。
(目的是使每节页码与前面的页码取消联系,这样就可以删除前面两页的页码) 5.将第一、二页的页码删除。
完毕。
如何用vba代码向word文档中插入表格
Sub AA()Dim projectno As String, projectname As String, datereceive As Date, datecomplate As Date, functionary As StringDim arr As ObjectDim i As LongDim brrprojectno = ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1, 2).RangeDim excelobject As ObjectSet excelobject = GetObject("D:\Downloads\project(word)\project.xls")Set arr = excelobject.Sheets(1).usedrange()brr = arrFor i = 2 To UBound(brr)If InStr(1, projectno, brr(i, 1)) >0 Thenprojectname = brr(i, 2)datereceive = brr(i, 3)datecomplate = brr(i, 4)functionary = brr(i, 5)Exit ForEnd IfNext iActiveDocument.Tables(1).Cell(1, 2).Range = projectnameActiveDocument.Tables(1).Cell(2, 2).Range = datereceiveActiveDocument.Tables(1).Cell(3, 2).Range = datecomplateActiveDocument.Tables(1).Cell(4, 2).Range = functionaryexcelobject.Close FalseEnd Sub
-
给我们打电话
7*24小时服务热线:1399999999
全国客服热线:400-0000-000 -
百度地图
福建省漳州市 -
给我们发邮件
E-mail:[email protected]
在线沟通