PSWriteOffice
PSWriteOffice copied to clipboard
Close-OfficeWord unable to close an open worddoc without a valid WordDoc object being passed.
The syntax for Close-OfficeWord suggests that the -Document parameter is optional. That would lead one to believe that if they had done an Get-OfficeWord without assigning the output to a variable, that they could then simply execute Close-OfficeWord to close it again, but that doesn't appear to be the case.
Additionally, should one's script error before having a chance to close a previously opened document, that document is held in limbo until the PowerShell session is closed.