PPT_LOGO_4b
Revit Programming Introduction <#>
Copyright © 2009 Autodesk Inc.
Excel を起動してワークブックを追加
»Imports MsExcel = Microsoft.Office.Interop.Excel
»
»' Launch/Get Excel (via COM Interop)
»Dim excel As MsExcel.Application = New MsExcel.ApplicationClass()
»If (excel Is Nothing) Then
»  MsgBox("Failed to get or start Excel!?")
»  Return IExternalCommand.Result.Failed
»End If
»excel.Visible = True    ' Make it visible "live" to the user
»
»' Add a new work-book and delete the default work-sheets
»Dim workbook As MsExcel.Workbook = excel.Workbooks.Add()
»Dim worksheet As MsExcel.Worksheet
»Do While workbook.Sheets.Count > 1
»  worksheet = workbook.Sheets.Item(1)
»  worksheet.Delete()
»Loop
»
»' Loop all collected Categories and create one worksheet for each
»Dim mapIter As Autodesk.Revit.Collections.MapIterator = sortedElements.ForwardIterator
»Do While (mapIter.MoveNext())
»  ' retrieve stored category and ElementSet
»  Dim categoryName As String = mapIter.Key
»  Dim elementSet As Autodesk.Revit.ElementSet = mapIter.Current
»  ' create and name the worksheet
»  worksheet = excel.Worksheets.Add()
»  worksheet.Name = categoryName
パラメーター