VBA Question

B

Brent E

Good afternoon,

I am using an Access module to contol Excel and Word and I need to know if
there's a way to check to see first, if Excel and Word are running. If they
are not, then I need to run them, If they are already open, I need to see if
doc is already open and if not, to open a blank doc? Any suggestions? Thanks.

Cordially,
 
L

Luiz Cláudio C. V. Rocha [MVP]

Try this:

Sub teste()
On Error Resume Next
AppActivate "Microsoft Word"
If Err = 0 Then
MsgBox "MS-Word is open."
Else
MsgBox "Ms-Word is closed."
On Error GoTo 0
End If

End Sub
 
G

George Nicholson

You might want to look at the VB Help file for GetObject (and/or
CreateObject).

HTH,
 
Top