Initial commit
This commit is contained in:
47
EDOKA/EDEX/Serienbriefe/frmExcelSheets.vb
Normal file
47
EDOKA/EDEX/Serienbriefe/frmExcelSheets.vb
Normal file
@@ -0,0 +1,47 @@
|
||||
Public Class frmExcelSheets
|
||||
Dim m_excelsheet As String
|
||||
Property ExcelSheet() As String
|
||||
Get
|
||||
Return m_excelsheet
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
m_excelsheet = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Dim m_excelfile As String
|
||||
Property ExcelFile() As String
|
||||
Get
|
||||
Return m_excelfile
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
m_excelfile = value
|
||||
End Set
|
||||
End Property
|
||||
Private Sub frmExcelSheets_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||||
|
||||
Dim intxls As New Microsoft.Office.Interop.Excel.Application
|
||||
intxls.Workbooks.Open(ExcelFile)
|
||||
For Each s As Microsoft.Office.Interop.Excel.Worksheet In intxls.ActiveWorkbook.Sheets
|
||||
Me.lstSheets.Items.Add(s.Name)
|
||||
Next
|
||||
intxls.ActiveWorkbook.Close(False)
|
||||
intxls.Quit()
|
||||
intxls = Nothing
|
||||
End Sub
|
||||
|
||||
Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click
|
||||
Me.ExcelSheet = "[" & Me.lstSheets.SelectedItem & "$]"
|
||||
Me.DialogResult = Windows.Forms.DialogResult.OK
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAbbruch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAbbruch.Click
|
||||
Me.DialogResult = Windows.Forms.DialogResult.Cancel
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub lstSheets_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstSheets.DoubleClick
|
||||
BtnOK_Click(sender, e)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user