Skip to content

Instantly share code, notes, and snippets.

@rajraj
Created June 23, 2016 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajraj/80b698dac2a06ca7885f26baafb5e21d to your computer and use it in GitHub Desktop.
Save rajraj/80b698dac2a06ca7885f26baafb5e21d to your computer and use it in GitHub Desktop.
MS Word Extract Pages
' 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