Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 21st, 2006, 3:39 AM   #1
cypher_soundz
Newbie
 
cypher_soundz's Avatar
 
Join Date: Jan 2005
Posts: 15
Rep Power: 0 cypher_soundz is on a distinguished road
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
cyph
cypher_soundz is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:39 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC