S
Shiraz
I am looking at this article in the knowledge base :
http://support.microsoft.com/kb/306348
And I am attempting to break up this very large word document into smaller
files with page range of 50 pages for example.
Since I am new to this sort of programming I would appreciate any help. Also
pointing to any resources would be cool.
This is how far I have gotten with the help of the above KB article:
Sub ExtractSections()
'
' ExtractSections Macro
'
' Used to set criteria for moving through the document by page.
Application.Browser.Target = wdBrowsePage
For i = 3 To 5
' ActiveDocument.BuiltInDocumentProperties("Number of Pages")
'Select and copy the text to the clipboard.
ActiveDocument.Bookmarks("\page").Range.Copy
' Open new document to paste the content of the clipboard into.
Documents.Add
Selection.Paste
' Removes the break that is copied at the end of the page, if any.
Selection.TypeBackspace
' Move the selection to the next page in the document.
Application.Browser.Next
Next i
ChangeFileOpenDirectory "C:\"
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc"
ActiveDocument.Close
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
I know little about this API. I am taking a sample document and WANTED to
extract pages between the range 3-5 from it. This is incorrectly implemented
ofcourse.
http://support.microsoft.com/kb/306348
And I am attempting to break up this very large word document into smaller
files with page range of 50 pages for example.
Since I am new to this sort of programming I would appreciate any help. Also
pointing to any resources would be cool.
This is how far I have gotten with the help of the above KB article:
Sub ExtractSections()
'
' ExtractSections Macro
'
' Used to set criteria for moving through the document by page.
Application.Browser.Target = wdBrowsePage
For i = 3 To 5
' ActiveDocument.BuiltInDocumentProperties("Number of Pages")
'Select and copy the text to the clipboard.
ActiveDocument.Bookmarks("\page").Range.Copy
' Open new document to paste the content of the clipboard into.
Documents.Add
Selection.Paste
' Removes the break that is copied at the end of the page, if any.
Selection.TypeBackspace
' Move the selection to the next page in the document.
Application.Browser.Next
Next i
ChangeFileOpenDirectory "C:\"
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc"
ActiveDocument.Close
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
I know little about this API. I am taking a sample document and WANTED to
extract pages between the range 3-5 from it. This is incorrectly implemented
ofcourse.