View Single Post
  #2   Report Post  
AA2e72E
 
Posts: n/a
Default

try inserting this in your code just before you begin to populate the newly
created document:

Application.Documents(2).Activate


"Cor van der Bliek" wrote:

I create documents, based on a special template. A Userforms collect all the
text in the fields and puts them on the appropriate places in the document.
This works fine the first time I do this. The second time, with a document
showing I have filled this way, a new document is created, but doesn't get
the focus. In other words when the Userform pops up, the first document is
still showing as the active document and the process of putting the input
text in the the new document fails, since Word tries to put the text in the
already filled in document.
The new document has been created, it shows as second in the list under the
Windows command.
How do I get the new document to become the active document before showing
the Userform?