クリップボードのデータを指定したセルに貼り付ける処理です。
※以下のサンプルソースでは、すでにクリップボードに
何らかのデータが保存されていると仮定して処理を書いています。
' Excelアプリケーション Dim xlApp As Application = Nothing xlApp = New Application ' ワークブック Dim xlBooks As Workbooks = Nothing Dim xlBook As Workbook = Nothing ' シート Dim xlSheets As Sheets = Nothing Dim xlSheet as WorkSheet = nothing ' セル Dim xlRange As Range = Nothing Dim xlCells As Range = Nothing xlApp = New Application xlBooks = xlApp.Workbooks xlBook = xlBooks.Open('対象ファイルまでの完全パス') xlSheets = xlBook.Worksheets xlSheet = DirectCast(xlSheets(1), Worksheet) ' 1シート目を操作対象に設定 xlCells = xlSheet.Cells xlRange = DirectCast(xlCells(1, 1), Range) ' セルA1を張り付け対象に設定 ' クリップボードのデータを張り付け xlRange.PasteSpecial()