View Single Post
  #5  
Old August 14th, 2008, 06:23 AM posted to microsoft.public.word.newusers
Graham Mayor
external usenet poster
 
Posts: 18,297
Default How to remove automatically some pages?

The lines indicated in red have wrapped prematurely use the following which
should not wrap

Sub DeleteMarkedPages()
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:="\", _
MatchWildcards:=False, _
Wrap:=wdFindContinue, _
Forward:=True) = True
Selection.Bookmarks("\page").Range.Delete
Loop
End With

http://www.gmayor.com/installing_macro.htm

The macro will remove any page with the \ character in Word 2007 and should
work in Word 97 also, though I don't have it available to check. Word 2007
will open a Word document from Word 97 without the need to 'convert' it.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Tico wrote:
Thank you very much for your prompt reply.

Unfortunately I don't know enough about macros to be able to use the
macro. When I tried to use it I got the following lines in red:

Do While .Execute(FindText:="#*#", MatchWildcards:=False,
Wrap:=wdFindContinue, Forward:=True) = True
Selection.Bookmarks("\page").Range.Delete
regardless what I replaced the "#*#" with.
My special character is \. I don't even know what I should writei n
the macro: "#\#", "\" or simply \
I haven't found FindText in the "VBA for Dummies" for Office 97 that
I have so I think I should save my file as Word 2007 first and then use
the macro.
I have Office 2007 (home edition) but I am not familiar with it yet,
at least not to use macros.
I am afraid I'll have to remove the pages manually. :-(

Regards
Tico


Użytkownik "Doug Robbins - Word MVP" napisał
w wiadomości ...
Use a macro containing the following code where you replace the #*#
with the special character that you intend to use. Selection.HomeKey
wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="#*#", MatchWildcards:=False,
Wrap:=wdFindContinue, Forward:=True) = True
Selection.Bookmarks("\page").Range.Delete Loop
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Tico" wrote in message
...
Hi All,

I have a big MS Word 97 file.
I am looking for any method that let me remove
automatically some pages which I can mark
using, for example, a special character as the
first on each page or in any other way.
I would be also satisfied if I could automatically
skip the pages whilst printing the file.

I can use the MS Word 2007 to do it, if necessary.

Could anyone help me please?
The matter is urgent.:-)

Regards
Tico