S
sait
Have a worddoc with vba-kode. sub AutoOpen does some mailmerging and sends
the resulting merged doc to a new doc with the wdSendToNewDocument. The new
doc is saved without the macro, and works fine. The vba-code close the
template, and remains with the new doc, wich is also saved . The problem is
that if there are previously open doc's in word, I loose focus from the new
saved doc when the macro finishes. Focus is set by word to the first window
in the active windows list. This means that the user will have to navigate
windows to make the new doc visible. I want the macro to handle this, and
have tried several techniques to activate the new window, wich may be number
2 og more in the list, depending on the number of open docs. I'm not able to
overload this. I was hoping that Documents(docName).Activate or
ActiveDocument.Activate would work, but it seems like this code is run and
then word runs it's own code afterwords. Some one who knows? Thanks! (Tried
many other techs too)
the resulting merged doc to a new doc with the wdSendToNewDocument. The new
doc is saved without the macro, and works fine. The vba-code close the
template, and remains with the new doc, wich is also saved . The problem is
that if there are previously open doc's in word, I loose focus from the new
saved doc when the macro finishes. Focus is set by word to the first window
in the active windows list. This means that the user will have to navigate
windows to make the new doc visible. I want the macro to handle this, and
have tried several techniques to activate the new window, wich may be number
2 og more in the list, depending on the number of open docs. I'm not able to
overload this. I was hoping that Documents(docName).Activate or
ActiveDocument.Activate would work, but it seems like this code is run and
then word runs it's own code afterwords. Some one who knows? Thanks! (Tried
many other techs too)