Solved

how to get Word doc on top of Access

Posted on 2002-05-10
7
275 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now