Shapes Moved to the wrong pages using VBA

R

Rick Ruud

I'm using VBA to construct a new publisher document (Publisher 2003) from an
existing publisher document. I open the old document in a new instance of
publisher and then determine the number of pages needed in the new doc and
add them.

I then go thru and select groups of shapes from the old document and
transrfer them to the new document through the clipboard. The logic for
selecting the shapes works fine and the logic for determining the page to
pasted to works fine.

The problem I'm having is that the shapes are being pasted to the wrong
pages. When I run the code at full speed the groups of shapes are posted all
over the place many overlaying pages. The shapes are all there but pages are
either blank or overlayed.

When I run the same code with a breakpoint before each copy and paste
operation most of the pages are pasted to correctly but the last few have
some overlays.

Any ideas would be appreciated.
 
E

Ed Bennett

Rick Ruud said:
When I run the same code with a breakpoint before each copy and paste
operation most of the pages are pasted to correctly but the last few
have some overlays.

A very interesting problem.
I can't say I've ever encountered it myself (a lot of use I am)

Have you tried adding a DoEvents before each copy and paste?
 
R

Rick Ruud

Thanks for replying Ed. No I haven't, but at this point I'm ready to try
anything. I'll post back if it helps.
 
R

Rick Ruud

Thanks Ed,

The DoEvents did clear up some overlay problems and revealed a
well-concealed bug in my code.
 

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