Difference between revisions of "RevitVBNETOpenExcel"

From scripting
Jump to: navigation, search
(Created page with " Imports MsExcel = Microsoft.Office.Interop.Excel Partial Class ThisDocument Public Sub OpenExcel() Dim excel As MsExcel.Application = New MsExcel.ApplicationCl...")
 
(No difference)

Latest revision as of 19:57, 24 April 2017

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