Bonjour,
Dans son message, < gary > écrivait :
In this message, < gary > wrote:
|| Hi,
||
|| I'd like use vba to modify an existing document
|| so that only those pages that contain markups
|| are saved (i.e. remove all pages that don't contain
|| markup)
||
|| Any help would be much appreciated.
||
|| I'm using the word 2003 object model
||
If by markup you mean revisions, try this code.
Note that at the beginning of the code I have to turn off track changes
otherwise the act of deleting a page will add a revision mark...
'_______________________________________
Dim PageRge As Range
Application.ScreenUpdating = False
ActiveDocument.TrackRevisions = False
With Selection
.HomeKey wdStory
Do While .Start < ActiveDocument.Range.End - 1
Set PageRge = .Bookmarks("\Page").Range
With PageRge
If .Revisions.Count > 0 Then
.Select
Selection.Collapse wdCollapseEnd
Else
.Delete
End If
End With
Loop
End With
Application.ScreenRefresh
Application.ScreenUpdating = True
'_______________________________________
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org