Re: Deleting Even Pages Within Page-Range

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Jason,

I'm wondering if this is possible, and if someone could provide (or
point me to) some sample code that would help me build a macro to
accomplish this task...

Let's say I have a 200 page document. The first chapter must remain
static, but all remaining chapters (defined by section breaks) need to
be 'cleaned up' by deleting ALL even-numbered pages.

I would like to bind this to a macro to automate this massive page
deletion process. Ideas?

PS: I've found a code snippet from another thread... how could you
modify it to only delete even pages?

Sub pages_go_away()
Selection.Goto what:=wdGoToPage, which:=wdGoToAbsolute, Count:=4
For counter = 4 to 21
You could try:

Dim Mycounter As Long
For Mycounter = 20 to 4 Step -2
Selection.Goto what:=wdGoToPage, which:=wdGoToAbsolute, Count:=Mycounter
ActiveDocument.Bookmarks("\page").Select
Msgbox Selection.Information(wdActiveEndAdjustedPageNumber) 'For testing
'Selection.Delete 'Comment out for testing
Next Mycounter

But I agree with Charles that paging depends on what printer is the active
default printer. If the document is using formatting to force blank even
pages, then change that formatting to not use blank even pages. Also look up
the repaginate method in VBA help for repaginating a document.

ActiveDocument.Bookmarks("\page").Select
Selectuion.Delete
Next counter
End Sub


--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

.



Relevant Pages

  • Re: help with paragraph formatting macro
    ... Paragraph styles contain indent ... formatting and can be assigned to a keyboard shortcut or menu command ... If you actually wanted a macro for this (and I don't think you ... If you are not coming from using Word Perfect you can ignore ...
    (microsoft.public.word.vba.customization)
  • Re: Conditional Formatting and Macros in Excel
    ... macro and others can help from there. ... Sub RecordedMacro() ... ' move into a single cell of newly formatted row ... Removing the formatting and coloring the relevant cells is ...
    (microsoft.public.excel.newusers)
  • Re: identifying a specific table in a macro?
    ... a macro can check the style of the table's text to distinguish ... ' do your formatting here, ... .OutsideLineStyle = wdLineStyleSingle ... .LineStyle = wdLineStyleSingle ...
    (microsoft.public.word.tables)
  • Re: Protect_Unprotect Macro modification.
    ... I run the macro to unprotect and the row formatting is available, right clicking on highlighted rows shows this. ... If I unprotect / protect manually then all the formatting remains available, but not if I use the macro. ... For Each wkSht In ActiveWorkbook.Worksheets ...
    (microsoft.public.excel.worksheet.functions)
  • Re: How can I set a repeated action to a shortcut key?
    ... ' Look for superscript text in brackets ... can't do it with the recorder, I don't think I'll bother, though, as ... The macro you want to record is going to take several steps. ... If you meant to have the macro make the same formatting change to ...
    (microsoft.public.word.docmanagement)