![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 15
Rep Power: 0
![]() |
VBA WORD2k w/API? Set focus new doc after document closed
Maybe a bit of a catch 22 here, i have been trying to figure this out for some time and to no avail.
I am programming in VBA in Word 2000, I have a main doc that will search the given criteria for templates, the user will select which template they would like to open and this template is then opened as a document from that template. My problem is that i have been trying to close down the first document after the second document is in forcus. Easy you say? well how about if 2 documents are already open? [doc1][doc2][SearchDoc][NewSpawnedDoc] doc1 and doc2 are documents the user already had open, SearchDoc is my search VBA Program, and NewSpawnedDoc is the newly created document, if the SearchDoc is then closed the window in forcus will be doc2 and not NewSpawnedDoc. I have been trying with the Sleep API Function but the outcome it still the same. Any ideas ? Code below ![]() play = Documents.Add(Template:=aother) 'The line below will bring the freshly opened document in focus ActiveWindow.SetFocus Documents(doc).Close SaveChanges:=wdDoNotSaveChanges 'close search form |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|