office办公软件是如今较为普遍的一种办公软件,word便是其中的一种。今天为大家分享一则如何将一个word文档按页分割成多个word文档的方法。
材料/工具
电脑
方法
打开需要分割的文档
键入ALT+F11打开辑器
点击插入,模块
粘贴下面的代码:
Option Explicit
Sub SplitPagesAsDocuments()
Dim oSrcDo谈c As Document, oNewDoc As D360新知ocument
Dim strSrcName As String, strNewName As String
Dim oRange As Range
Dim nIndex As Integer
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set oSrcDoc = ActiveDocument
Set oRange = oSrcDoc.Content
oRange.Collapse wdCollapseStart
oRange.Select
For nIndex = 1 To ActiveDocument.Content.
Information(wdN选行元需究除跟世硫转umberOfPagesInDocument)
oSrcDoc.Bookmarks("\page").Range.Copy
oSrcDoc.Windows(1).Activate
Application.Browser.Target = wdBrowsePage
Application.Browser.NextstrSrcName = oSrcDoc
.FullName
strNewName = fso.BuildPath(fso.GetParentFolder
Name(strSrcName), _
fso.GetBaseName(strSrcName) & "_" & nIndex & "." & fso.GetExtensionName(strSrcName))
Set oNewDoc = Documents.Add
Selection.Paste
oNewDoc.SaveAs strNewName
oNewDoc.Close False
Next
Set oNewDoc = Nothing
Set oRange = Nothing
Set oSrcDoc = Nothing
Set fso = Nothing
MsgBox "结束!"
End Sub
键入F5运行,看到“完成!”
成功!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 951076433@qq.com 举报,一经查实,本站将立刻删除。如若转载,请注明出处:https://www.xiaomafuwu.com/201648.html