tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル Re^2: Excelのプロセスが終了しない
投稿日: 2005/04/04(Mon) 13:31
投稿者VB.net初心者
花ちゃんさん、魔界の仮面弁士さん、ご教授ありがとうございます。

前の行をコピーする部分を下記のように修正しました。
しかし、まだプロセスがうまく終了してくれません。

Dim R1 As Excel.Range
Dim R2 As Excel.Range
Dim RCopy As Excel.Range
Dim RPaste As Excel.Range

xlCells = xlSheet.Cells
R1 = DirectCast(xlCells._Default(row_cnt - 1, 1), Excel.Range)
R2 = DirectCast(xlCells._Default(row_cnt - 1, 7), Excel.Range)
RCopy = xlSheet.Range(R1, R2)
RCopy.Copy()
RPaste = DirectCast(xlCells._Default(row_cnt, 1), Excel.Range)
RPaste.Insert()
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlCells)
System.Runtime.InteropServices.Marshal.ReleaseComObject(R1)
System.Runtime.InteropServices.Marshal.ReleaseComObject(R2)
System.Runtime.InteropServices.Marshal.ReleaseComObject(RCopy)
System.Runtime.InteropServices.Marshal.ReleaseComObject(RPaste)

しかも、デバッグのためにxlCells以外のところを全てコメントアウトしてもダメでした。

xlCells = xlSheet.Cells
'R1 = DirectCast(xlCells._Default(row_cnt - 1, 1), Excel.Range)
'R2 = DirectCast(xlCells._Default(row_cnt - 1, 7), Excel.Range)
'RCopy = xlSheet.Range(R1, R2)
'RCopy.Copy()
'RPaste = DirectCast(xlCells._Default(row_cnt, 1), Excel.Range)
'RPaste.Insert()
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlCells)
'System.Runtime.InteropServices.Marshal.ReleaseComObject(R1)
'System.Runtime.InteropServices.Marshal.ReleaseComObject(R2)
'System.Runtime.InteropServices.Marshal.ReleaseComObject(RCopy)
'System.Runtime.InteropServices.Marshal.ReleaseComObject(RPaste)

xlCells = xlSheet.Cellsのなかに、xlCells以外で解放しなければならないものがあるのでしょうか?

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。