如何将一个word按页分成多个

 时间:2024-10-12 08:45:10

1、第一步:举例,准备一个要分割的word文档;如图:

如何将一个word按页分成多个

3、第三步:点击插入——模块,如图:

如何将一个word按页分成多个

4、第四步:输入下面代码:Option ExplicitSub SplitEveryFivePagesAsDocuments()Dim oSrcDoc As Document, oNewDoc As DocumentDim strSrcName As String, strNewName As StringDim oRange As RangeDim nIndex As Integer, nSubIndex As Integer, nTotalPages As Integer, nBound As IntegerDim fso As ObjectConst nSteps = 1 ' 修改这里控制每隔几页分割一次Set fso = CreateObject("Scripting.FileSystemObject")Set oSrcDoc = ActiveDocumentSet oRange = oSrcDoc.ContentnTotalPages = ActiveDocument.Content.Information(wdNumberOfPagesInDocument)oRange.Collapse wdCollapseStartoRange.SelectFor nIndex = 1 To nTotalPages Step nStepsSet oNewDoc = Documents.AddIf nIndex + nSteps > nTotalPages ThennBound = nTotalPagesElsenBound = nIndex + nSteps - 1End IfFor nSubIndex = nIndex To nBoundoSrcDoc.ActivateoSrcDoc.Bookmarks("\page").Range.CopyoSrcDoc.Windows(1).ActivateApplication.Browser.Target = wdBrowsePageApplication.Browser.NextoNewDoc.ActivateoNewDoc.Windows(1).Selection.PasteNext nSubIndexstrSrcName = oSrcDoc.FullNamestrNewName = fso.BuildPath(fso.GetParentFolderName(strSrcName), _fso.GetBaseName(strSrcName) & "_" & (nIndex \ nSteps + 1) & "." & fso.GetExtensionName(strSrcName))oNewDoc.SaveAs strNewNameoNewDoc.Close FalseNext nIndexSet oNewDoc = NothingSet oRange = NothingSet oSrcDoc = NothingSet fso = NothingMsgBox "结束!"End Sub

如何将一个word按页分成多个
  • word文档如何拆分出多个文档?
  • 把一个word文档拆分为多个文档
  • 如何把word文档里的页面拆分成每页单独的文档
  • 如何将一个word文档按页分割成多个word文档?
  • Word如何拆分文档?
  • 热门搜索
    头皮屑很多怎么办 电子报刊怎么做 范冰冰怎么了 额头宽适合什么发型 孕期感冒 男士发型大全 狗的年龄怎么算 男生烫发发型 被猫抓伤怎么办 果酱怎么做