Re: How to tell if word is already running

Tech-Archive recommends: Speed Up your PC by fixing your registry



Dirk - Thanks!

One additional question, If I find it is running can I issue a quit command
(oWord.Quit) to close the running instance before continuing my code? Will
this allow the user to either save the current document or will it just close
Word without offering a save as dialog?

TFH! - Jerry

"Dirk Goldgar" wrote:

> "JWS315" <JWS315@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:76C8352A-32A6-479A-8016-5D03221796B5@xxxxxxxxxxxxx
> > How can I tell if an instance of Word is already running from Access
> > so that I can issue a message to the user to close Word before they
> > run my report?
>
> One way is described at this link:
>
> http://www.mvps.org/access/api/api0007.htm
> API: Find out if an application is currently running
>
> Another way would be to try to get a reference to the Word application
> object, and see if you succeed:
>
> Dim oWord As Object
>
> On Error Resume Next
> Set oWord = GetObject(, "Word.Application")
> If Err.Number = 0 Then
> Set oWord = Nothing
> MsgBox "Word is running; please close it."
> End If
>
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>
.



Relevant Pages

  • Re: Startup form when Access loads
    ... to let my brain kick in. ... "Dirk Goldgar" wrote: ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.forms)
  • Re: Unclear Data Entry Form
    ... I went and double checked my Data Entry property ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.forms)
  • Re: Subforms
    ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.forms)
  • Re: Null Date
    ... and report on the results of that. ... Dirk I copied and pasted your above code...it's in red. ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.forms)
  • Re: I need help with a VBA search code
    ... > No dice. ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.modulesdaovba)