Solved

how to get Word doc on top of Access

Posted on 2002-05-10
7
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

707 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