Air Ticket Payroll Provision Report
Air Ticket Payroll Provision Report
' Open the source file without updating links, in read-only mode if necessary
On Error Resume Next
Set sourceWorkbook = Workbooks.Open(sourceFilePath, UpdateLinks:=0,
ReadOnly:=True)
If Err.Number <> 0 Then
MsgBox "Error opening source file. Exiting..."
Exit Sub
End If
On Error GoTo 0
Set sourceSheet = sourceWorkbook.Sheets(1)
If pos1 > 0 And pos2 > 0 And pos3 > 0 And pos4 > 0 Then
empNo = Mid(fileName, 1, pos1 - 1)
empNationality = Mid(fileName, pos1 + 1, pos2 - pos1 - 1)
memberCount = Mid(fileName, pos2 + 1, pos3 - pos2 - 1)
provisionAmount = Mid(fileName, pos3 + 1, pos4 - pos3 - 1)
MsgBox "Report generated and saved successfully in the same folder where you
selected the month!"
End Sub