Use Random Access Files to save a user defined data type
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 GetMaxRecNum()
Dim empData As Employee
Dim empDataLen As Long
Dim filePath As String
filePath = ActiveWorkbook.Path & "\Employees.txt"
empDataLen = FileLen(filePath)
Debug.Print empDataLen / Len(empData) + 1
End Sub
Related examples in the same category