G
Gary Hillerson
i have a Word VBA template with a lot of code and userforms in it, and
everything is working fine.
however, i've discovered that, if I create two documents (doc1 and
doc2) based on that same template and have both open at once, I get
strange behavior.
Specifically, whenever i call the .Show method of a userform in doc1,
all is fine. But if I call the .Show method of one of my userforms in
doc2, then doc1 becomes the ActiveDocument before that userform is
displayed. As a result, when the userform inserts text into the
document, it always gets inserted into doc1. And doc1 remains the
ActiveDocument.
I don't understand what I could be doing to change Word's idea of the
ActiveDocument, but I must be. Is there something special I need to do
in my code to handle having multiple documents open that are referring
to code in the same template?
any help/pointers appreciated.
thanks,
garyh
everything is working fine.
however, i've discovered that, if I create two documents (doc1 and
doc2) based on that same template and have both open at once, I get
strange behavior.
Specifically, whenever i call the .Show method of a userform in doc1,
all is fine. But if I call the .Show method of one of my userforms in
doc2, then doc1 becomes the ActiveDocument before that userform is
displayed. As a result, when the userform inserts text into the
document, it always gets inserted into doc1. And doc1 remains the
ActiveDocument.
I don't understand what I could be doing to change Word's idea of the
ActiveDocument, but I must be. Is there something special I need to do
in my code to handle having multiple documents open that are referring
to code in the same template?
any help/pointers appreciated.
thanks,
garyh