RevitVBNETOpenExcel

From scripting
Jump to: navigation, search
Imports MsExcel = Microsoft.Office.Interop.Excel
Partial Class ThisDocument
    Public Sub OpenExcel()
        Dim excel As MsExcel.Application = New MsExcel.ApplicationClass()
        If (excel Is Nothing) Then
            MsgBox("Failed to get or start Excel!?")
        End If
        excel.Visible = True
        Dim workbook As MsExcel.Workbook = excel.Workbooks.Add     '.new          '.Open(dlgFileXLS.FileName)
        Dim worksheet As MsExcel.Worksheet = workbook.ActiveSheet
    End Sub
End Class