RevitVBNETOpenExcel

From scripting
Revision as of 19:57, 24 April 2017 by Nickpisca (talk | contribs) (Created page with " Imports MsExcel = Microsoft.Office.Interop.Excel Partial Class ThisDocument Public Sub OpenExcel() Dim excel As MsExcel.Application = New MsExcel.ApplicationCl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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