指定されたキャストは有効ではありません
公開日:
:
最終更新日:2014/01/25
プログラミング
記事内に広告を含む場合があります。記事内で紹介する商品を購入することで、当サイトに売り上げの一部が還元されることがあります。
人力検索はてな用のソースコード。
Dim xlSelection As Excel.Range
xlSelection = xlApplication.Selection
Try
Dim xlBorders As Excel.Borders
xlBorders = xlSelection.Borders(Excel.XlBordersIndex.xlEdgeTop) ' ここで例外が発生
Try
xlBorders.LineStyle = Excel.XlLineStyle.xlContinuous
xlBorders.Weight = Excel.XlLineStyle.xlContinuous
xlBorders.ColorIndex = Excel.XlLineStyle.xlContinuous
Finally
If Not xlBorders Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBorders)
End If
End Try
Finally
If Not xlSelection Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSelection)
End If
End Try