Replace causing repagination

B

Bear

Hello:

I'm trying to remove all the "bullet and tab" prefixes from a range
(objList). I have this code:

With objList.Find
.Text = PrefixText
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With

Execution of this code causes Word to repaginate the document. At the end of
a long (300-page) document, this represents a fair chunk of time. Maybe two
seconds. That's not great for a macro that's just supposed to be toggling
bullets on and off.

Is there any way to replace all these without invoking repagination?

Bear
 
X

xxexbushpig

Hi Bear
You could try
Options.Pagination = False
at the beginning and
Options.Pagination = True
at the end.
It sometimes works for me.
 
B

Bear

BushPig:

Thanks for the suggestion, but it doesn't seem to have any effect for me.
The macro runs just fine in normal view, but in page layout view I just can't
seem to get around the repagination -- option settings or no.

I'd certainly be open to alternative strategies to replacing the text, but I
haven't been able to develop anything myself. Still not giving up though.

Bear
 
X

xxexbushpig

Question, Bear
Do you mean the repagination starts after your macro has run, or during the
run?BushPig:
 
B

Bear

BushPig:

The document repaginates after executing the .Execute Replace:=wdReplaceAll
statement, and before progressing to the next statement. I.E. it appears to
be part of the replacement command, or an intimately integrated Word response
to the replacement.

You probably wouldn't even notice it in a short document or near the start
of a long document. But on page 380 of 392, it's a pretty long wait.

Bear
 
F

fumei via OfficeKB.com

Page layout view will cause repagination, as that is the purpose of page
layout. You are changing stuff, and Word needs to repaginate - in page
layout view, as again that it what it IS.

Word does NOT know what the effects are in page layout until it does
repaginate.

You may think it is just toggling the bullets on or off, but Word does not
know that...until it repaginates.

You could, I suppose, switch to normal view at the start of the code, then
switch back to page layout view at the end. But I think when you switch back
to page layout, it will repaginate anyway. As that is what it is supposed to
do.
 
B

Bear

Fumei:

I'm sure Word is working as it's supposed to work, and am not trying to
circumvent normal Page Layout operation. I was just hoping someone might have
an alternative method to replacing the bullets that didn't invoke
repagination. I'm not tied to the Find operation.

Bear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top