Odd VBA behaviour with task pane and header.

H

Hexagonvex

Hi,

I hope someone can help me on this one because it's been driving me
crazy for some time now.

I am using a macro that I trigger from a custom toolbar. The code
executed generates a table in the header of the document, inserts some
text, formats the text, merges cells, inserts a picture a.s.o.

Ok so far so good. But this works ONLY IF the task pane is not there.
If the task pane is there the same code that worked fine before
generates a runtime error 4605.

Furthermore I have noticed a considerable slowing down of code
execution. We have more machines with the same basic images and a
distribution of the same add-ins locally on the machine (the code that
gets executed local resides in a template that is stored locally in the
startup folder of Word 2003).

On other machines code execution is roughly 4 - 6 times faster than on
mine....code is the same. That is why I am not concentrating on
Selection or Range since the same code runs fast on some machines and
slow on others (same hardware config).

Any ideas?

A big up to those who will try to help :)

Hexagonvex
 
J

Jean-Guy Marcil

Hexagonvex was telling us:
Hexagonvex nous racontait que :
Hi,

I hope someone can help me on this one because it's been driving me
crazy for some time now.

I am using a macro that I trigger from a custom toolbar. The code
executed generates a table in the header of the document, inserts some
text, formats the text, merges cells, inserts a picture a.s.o.

Ok so far so good. But this works ONLY IF the task pane is not there.
If the task pane is there the same code that worked fine before
generates a runtime error 4605.

Furthermore I have noticed a considerable slowing down of code
execution. We have more machines with the same basic images and a
distribution of the same add-ins locally on the machine (the code that
gets executed local resides in a template that is stored locally in
the startup folder of Word 2003).

On other machines code execution is roughly 4 - 6 times faster than on
mine....code is the same. That is why I am not concentrating on
Selection or Range since the same code runs fast on some machines and
slow on others (same hardware config).

Any ideas?

A big up to those who will try to help :)

I suspect that you are running into trouble because you are using the
Selection object and opening the header view.

Post your code and it will be easy enough to show you how to use the Range
object instead.


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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