• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

how to get Word doc on top of Access

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
emijohns
Asked:
emijohns
1 Solution
 
RichWCommented:
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
 
James ElliottCommented:
I use this.


 AppActivate "Microsoft Word", 1

Thanks

Jell
0
 
emijohnsAuthor Commented:
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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
PaurthsCommented:
should not matter.
if u use late binding, the properties, methods and events are also available.

cheers
Ricky
0
 
RichWCommented:
If you use late binding and AppActivate objWord.Caption in my example, it shouldn't matter.



0
 
emijohnsAuthor Commented:
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
 
RichWCommented:
Thanks emijohns.  Glad I could help.
RichW
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now