Susan Harkins
ssharkins at gmail.com
Fri Jan 25 17:11:50 CST 2008
John, what do you mean by hidden? The following code is pretty typical and it's probably what you're already using. My guess is this hidden business is something different? Susan H. Dim appWord As Word.Application Dim doc As Word.Document 'Avoid error 429, when Word isn't open. On Error Resume Next Err.Clear 'Set appWord object variable to running instance of Word. Set appWord = GetObject(, "Word.Application") If Err.Number <> 0 Then 'If Word isn't open, create a new instance of Word. Set appWord = New Word.Application End If Susan H. >I am using a mail merge system that occasionally leaves Word open but > hidden. The next time the mail merge tries to run it can't since word is > open and holding a file open that the mail merge function is trying to > create. Thus I need to get a handle on any open word instance, and > hopefully see if it is hidden. If so assume it is mine and close it. Is > there any way to do such a thing in VBA code?