I have a VBA macro that opens three documents (A, B & C), putting them in an array for later referral. The macro then opens a small userform that permits various Word searches in A, B & C.

However, whenever I click anywhere on the userform, the last of the three documents opened (C) comes to the fore. Why does this happen and how to prevent it? It is as if the userform has developed a permanent link with C. If the user closes C, then clicking on the userform no longer changes the focus document.

The code is all in a separate template, the documents have no code in them at all.

There is a statement aDoc.Activate that makes A, B or C the current active document, but clicking anywhere on the userform always brings C into focus, obscuring the other docs.

ShowModal is False and the userform is ‘shown’ with vbModeless.

I have an API call that keeps the small userform on top.

I’m using Word 2003 under Windows 7.

When minimizing doc C, the userform goes out of focus until doc C is brought back into focus.

Closing doc C does the trick, but is somewhat radical for our purposes.

The code is a little complex to post here.

Any guidance on underlying principles would be most welcome!