Private Sub Text1_LostFocus(Index As Integer)
Select Case Index
Case 1
'Set RS = New Recordset
ArrayFestivos "ORG_FESTIVOS", Text1(0), " WHERE TRANSFERIBLE=-1"
Grid.Clear
fechainicial = "01/" & Text1(1) & "/" & Text1(0)
numdias = DaysInMonth(fechainicial)
For i = 0 To numdias
With Grid
.Cols = numdias + 3
.FontFixed.Bold = True
.CellFontBold = False
.Redraw = False
.Rows = 7
.FixedRows = 2
.ColAlignmentFixed = 4 'flexAlignCenterCenter
For ii = 0 To .Rows - 1
.RowHeight(ii) = 300
Next
.ColWidth(0) = 300
.ColWidth(1) = 1300
.TextMatrix(1, 1) = "ID EMPLEADO"
.ColWidth(i + 1) = 400
If i <= .Cols - 4 Then
.TextMatrix(0, i + 2) = Format(CStr(FormatDateTime(fechainicial + i, vbShortDate)), "dd")
.TextMatrix(1, i + 2) = Letradiasemana(i + 1 & "/" & Text1(1) & "/" & Text1(0))
If Weekday(fechainicial + i, vbMonday) = 7 Then
numc = i + 2
fila = 1
.Col = numc
.Row = fila
.CellForeColor = vbRed
.TextMatrix(2, i + 2) = "D"
End If
If Weekday(fechainicial + i, vbMonday) = 7 Then
For filacolor = 3 To .Rows - 1
.Row = filacolor
.CellBackColor = RGB(209, 222, 253)
Next
End If
For x = 0 To UBound(aFestivosN)
fechafest = Format(CStr(FormatDateTime(fechainicial + i, vbShortDate)), "dd/mm/yyyy")
If fechafest = aFestivosN(x) Then
If Weekday(fechafest, vbMonday) = 7 Then
numc = i + 3
fila = 1
.Col = numc
.Row = fila
.CellForeColor = vbRed
.TextMatrix(2, i + 3) = "F"
Else
numc = i + 2
fila = 1
.Col = numc
.Row = fila
.CellForeColor = vbRed
.TextMatrix(2, i + 2) = "F"
End If
End If
Next x
End If
.ColWidth(.Cols - 1) = 900
.TextMatrix(1, .Cols - 1) = "HORAS"
.Col = 1
.Row = 3
.Redraw = True
End With
Next i
'End If
End Select
End Sub
codigo msflexgrid