Private Type Employee
empID As String * 8
empName As String * 20
empAge As Integer
empStatus As String * 10
empSalaryClass As String * 1
End Type
Sub GetEmployeeInfo()
Dim empData As Employee
Dim filePath As String
filePath = ActiveWorkbook.Path & "\Employees.txt"
Open filePath For Random As #1 Len = Len(empData)
Get #1, recNum, empData
Cells(2, "A").Value = empData.empID
Cells(2, "B").Value = empData.empName
Cells(2, "C").Value = empData.empAge
Cells(2, "D").Value = empData.empStatus
Cells(2, "E").Value = empData.empSalaryClass
Close #1
End Sub
|