Dim oWord As Object = Nothing Try oWord = GetObject(, "Word.Application") Catch ex As Exception oWord = CreateObject("Word.Application") End Try '以下、処理および取得したCOMオブジェクト変数の解放