Created
June 23, 2016 15:01
-
-
Save rajraj/80b698dac2a06ca7885f26baafb5e21d to your computer and use it in GitHub Desktop.
MS Word Extract Pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Macro to Extract pages | |
Sub mcrExtractPages() | |
Application.Browser.Target = wdBrowsePage | |
For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages") | |
ActiveDocument.Bookmarks("\page").Range.Copy | |
Documents.Add | |
Selection.Paste | |
ChangeFileOpenDirectory "C:\Temp" | |
DocNum = DocNum + 1 | |
ActiveDocument.SaveAs FileName:="ExtractedPage_" & DocNum & ".docx" | |
ActiveDocument.Close | |
Application.Browser.Next | |
Next i | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment