Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

Activating a document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
markl59@gmail.com - 11 Sep 2006 16:46 GMT
Hi,
I'm building a macro that buils and opens a new document from a User
Form contained in the current document. When I've built the new
document  I want to close the current one and activate (or bring to the
front) the new one. However if I already have documents open, I
activate the new one but then the code to unload the old one appears to
reactivate it. Then when it does unload, focus goes to the first open
document., not my current one. Is there a way I can activate the new
doc without 'losing focus'  when further code runs in the old one
(though it is only a Close ).
Thanks for any ideas,
Mark
Jezebel - 11 Sep 2006 23:43 GMT
1. The code shouldn't be in any document. It should be in a global template
or an add-in. That way the code is not affected by the documents you open or
close.

2. When you create the document, get a reference to it; then active that
reference --

Dim pDoc as Word.Document
set pDoc = Documents.Add(Template:="...)

pDoc.Activate

> Hi,
> I'm building a macro that buils and opens a new document from a User
[quoted text clipped - 8 lines]
> Thanks for any ideas,
> Mark
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.