Solved

how to get Word doc on top of Access

Posted on 2002-05-10
7
276 Views
Last Modified: 2006-11-17
Hi,

I have a function in an Access 97 db that opens a (or creates a new) Word document and fills in its bookmarks with information from the database.

I recently updated the database to change some things and now when it opens/creates the Word document, Access is always visible on the screen while Word is in the background and on the task bar.  Whereas before when Word was open it was the active program (not Access).

Does anyone know what I did that made this switch?  Even a suggestion of where to look would be helpful. Does anyone know any code that will bring Word to the front and Access to the back?

Thanks for any help you can give!
emijohns
0
Comment
Question by:emijohns
7 Comments
 
LVL 4

Accepted Solution

by:
RichW earned 100 total points
ID: 7001722
You can use the AppActivate method to gain focus to the Word app.

Example:

Dim objWord as Object
set objWord = GetObject(,"Word.Application")
AppActivate objWord.Caption
0
 
LVL 12

Expert Comment

by:James Elliott
ID: 7001783
I use this.


 AppActivate "Microsoft Word", 1

Thanks

Jell
0
 

Author Comment

by:emijohns
ID: 7001813
I keep getting Error 5: Invalid procedure call or argument

any clue?

Just in case anyone is thinking about it...I can't set References to Word 8.0 because we have multiple platforms using this database and therefore can't reference one specific version of Word.

Will that cause problems with having AppActivate work?

Thanks!
emijohns
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 12

Expert Comment

by:Paurths
ID: 7001967
should not matter.
if u use late binding, the properties, methods and events are also available.

cheers
Ricky
0
 
LVL 4

Expert Comment

by:RichW
ID: 7002182
If you use late binding and AppActivate objWord.Caption in my example, it shouldn't matter.



0
 

Author Comment

by:emijohns
ID: 7002229
I was getting the error because of the location I put the code in.

This code worked great!  Plugged it in and was ready to go.

Thanks!
0
 
LVL 4

Expert Comment

by:RichW
ID: 7002260
Thanks emijohns.  Glad I could help.
RichW
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question