Hi Guy's, I am trying to find a short piece of code to close a word document but checking that it is still open as the wdDoc is set to visible false
I am getting a debug on the bold line
Code:Dim wdApp As Word.Application Set wdApp = GetObject(, "Word.Application") If wdApp.ActiveDocument = "" Then DoCmd.CancelEvent Else wdApp.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges End If