What is wrong with this macro ?
'Prints all pages with a given string
Dim Message As String, Title As String, Default As String, SpecialCode As String
Message = "Only pages containing following text (case sensitive) will be printed: " ' Set prompt
Title = "PrintPagesWithCodeword"
Default = "XYZ" ' Set default, is set as case sensitive below.
SpecialCode = InputBox(Message, Title, Default)
Selection.HomeKey Unit:=wdStory 'start at the beginning
Do While .Execute(FindText:=SpecialCode, Forward:=True, MatchCase:=True) = True
Original question was
Q.10306791 "Can I extract pages to print ? (WORD)".
I am getting very long documents by mail (under "*.doc" format). Within these numerous pages, I would like to print ONLY the pages beginning by a special code (let us say "XYZ"). Is this possible under MSWord 97 ?
I made a macro, tested and posted it. ACS accepted my comment before making a test run. After two modifications by me, each with what I thought sucessful printouts, it still does not run properly, instead of the pages with XYZ the first page is printed as many times XYZ is found (I must have been daydreaming, now, in a fresh doc, the sames happens on my PC)
Please fix this. It should be mentioned that ACS
a) Has tried the macro on both French OS + English MSOffice97 -SR2 and French OS and MSOffice97 -SR2. Also on Dutch OS and MSOffice97 -SR2.
b) He viewed document on "normal", "page layout", tried to print and got no difference (only first page printed).
c) Has launched the macro from toolbar, from special made toolbar (a button linked to the macro), from within the VB menu ... and got no difference.
d) Although I do not think it is a language support problem, I am including AC's french formulation of the question "Je recois de longs documents en format doc (MSWord) dont je ne desire imprimer qu'un certain nombre de pages marquees par un symbole "XYZ". Avez-vous idee comment on peut faire?".