Private
Const
sAdressDatei
As
String
=
"C:\Formblatt_Daten.xlsx"
Private
Const
sTabellenblatt2
As
String
=
"Inhalt"
Private
Sub
UserForm_Initialize()
Dim
oExcelApp
As
Object
Dim
oExcelWorkbook
As
Object
Dim
lZeile
As
Long
Set
oExcelApp = CreateObject(
"Excel.Application"
)
Set
oExcelWorkbook = oExcelApp.Workbooks.Open(sAdressDatei)
ListBox2.Clear
ListBox2.ColumnCount = 2
ListBox2.ColumnWidths =
"0,9cm;2,5cm;2cm;1,2cm"
lZeile = 2
With
oExcelWorkbook.Sheets(sTabellenblatt2)
Do
While
.Cells(lZeile, 1) <>
""
ListBox2.AddItem
CStr
(.Cells(lZeile, 2).Value)
.List(.ListCount - 1, 1) = .Cells(lZeile, 3).Value
lZeile = lZeile + 1
Loop
End
With
oExcelWorkbook.Close
False
oExcelApp.Quit
Set
oExcelWorkbook =
Nothing
Set
oExcelApp =
Nothing
End
Sub