Ir para conteúdo
Fórum Script Brasil
  • 0

Calendário com formato americano mês/dia/ano


Ana.Paula

Pergunta

Olá galera tenho uma programação com um calendário em formato americano mês/dia/ano, preciso modificá-lo para o brasileiro dia/mês/ano, alguém pode me ajudar?

 


Private diaSemana As Integer
Private PrimeiroDiaMes As Date
Private UltimoDiaMes As Date
Private DiasCalendario As Date
Private iMes, iAno As Integer
Private Botoes(1 To 6, 1 To 7) As Object
Private aCalendario(1 To 6, 1 To 7) As Date

Private Sub UserForm_Activate()
    iMes = Month(Now)
    iAno = Year(Now)
    PrimeiroDiaMes = "01/" & iMes & "/" & iAno
End Sub

Private Sub UserForm_Initialize()

Set Botoes(1, 1) = CommandButton1
Set Botoes(1, 2) = CommandButton2
Set Botoes(1, 3) = CommandButton3
Set Botoes(1, 4) = CommandButton4
Set Botoes(1, 5) = CommandButton5
Set Botoes(1, 6) = CommandButton6
Set Botoes(1, 7) = CommandButton7

Set Botoes(2, 1) = CommandButton8
Set Botoes(2, 2) = CommandButton9
Set Botoes(2, 3) = CommandButton10
Set Botoes(2, 4) = CommandButton11
Set Botoes(2, 5) = CommandButton12
Set Botoes(2, 6) = CommandButton13
Set Botoes(2, 7) = CommandButton14

Set Botoes(3, 1) = CommandButton15
Set Botoes(3, 2) = CommandButton16
Set Botoes(3, 3) = CommandButton17
Set Botoes(3, 4) = CommandButton18
Set Botoes(3, 5) = CommandButton19
Set Botoes(3, 6) = CommandButton20
Set Botoes(3, 7) = CommandButton21

Set Botoes(4, 1) = CommandButton22
Set Botoes(4, 2) = CommandButton23
Set Botoes(4, 3) = CommandButton24
Set Botoes(4, 4) = CommandButton25
Set Botoes(4, 5) = CommandButton26
Set Botoes(4, 6) = CommandButton27
Set Botoes(4, 7) = CommandButton28

Set Botoes(5, 1) = CommandButton29
Set Botoes(5, 2) = CommandButton30
Set Botoes(5, 3) = CommandButton31
Set Botoes(5, 4) = CommandButton32
Set Botoes(5, 5) = CommandButton33
Set Botoes(5, 6) = CommandButton34
Set Botoes(5, 7) = CommandButton35

Set Botoes(6, 1) = CommandButton36
Set Botoes(6, 2) = CommandButton37
Set Botoes(6, 3) = CommandButton38
Set Botoes(6, 4) = CommandButton39
Set Botoes(6, 5) = CommandButton40
Set Botoes(6, 6) = CommandButton41
Set Botoes(6, 7) = CommandButton42

iMes = Month(Now)
iAno = Year(Now)
PrimeiroDiaMes = "01/" & iMes & "/" & iAno

fAtualiza

For i = 1 To 6
    For J = 1 To 7
        Botoes(i, J).Caption = Day(aCalendario(i, J))
        If Weekday(aCalendario(i, J)) = 1 Or Weekday(aCalendario(i, J)) = 7 Then
            Botoes(i, J).BackColor = &HC0C0FF
        End If
        If aCalendario(i, J) = Format(Now, "dd/mm/yy") Then
            Botoes(i, J).BackColor = vbCyan
     
            
        End If
            
    Next
Next

Label9.Caption = "Hoje: " & Format(Now, "dd/mm/yy")


End Sub

Private Sub btmVolta_Click()
iMes = iMes - 1
If iMes = 0 Then
    iMes = 12
    iAno = iAno - 1
End If
PrimeiroDiaMes = "01/" & iMes & "/" & iAno

fAtualiza

End Sub

Private Sub btmAvanca_Click()

iMes = iMes + 1
If iMes = 13 Then
    iMes = 1
    iAno = iAno + 1
End If

PrimeiroDiaMes = "01/" & iMes & "/" & iAno

fAtualiza

End Sub
Function fAtualiza()

UltimoDiaMes = "01/" & iMes + 1 & "/" & iAno
UltimoDiaMes = UltimoDiaMes - 1
diaSemana = Weekday(PrimeiroDiaMes)
If Day(UltimoDiaMes) = 31 And diaSemana = 7 Then
    frmCalendario.Height = 308
    Label9.Top = 258
    
    For ii = 1 To 7
        Botoes(6, ii).Visible = True
    Next
Else
    frmCalendario.Height = 276
    Label9.Top = 228

    For ii = 1 To 7
        Botoes(6, ii).Visible = False
    Next
    
End If


PrimeiroDiaCalendario = PrimeiroDiaMes - diaSemana + 1

DiasCalendario = PrimeiroDiaCalendario
Label8.Caption = MonthName(iMes) & " de " & iAno


For i = 1 To 6
    For J = 1 To 7
        aCalendario(i, J) = DiasCalendario
        DiasCalendario = DiasCalendario + 1
    Next
Next

For i = 1 To 6
    For J = 1 To 7
        Botoes(i, J).Caption = Day(aCalendario(i, J))
                  
    Next
Next


End Function
Private Sub CommandButton1_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton2_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton3_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton4_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton5_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton6_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton7_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton8_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton9_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton10_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton11_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton12_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton13_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton14_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton15_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton16_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton17_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton18_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton19_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton20_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton21_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton22_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton23_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton24_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton25_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton26_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton27_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton28_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton29_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton30_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton31_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton32_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton33_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton34_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton35_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton36_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton37_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton38_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton39_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton40_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton41_Click()
    RetornaData Me.ActiveControl
End Sub
Private Sub CommandButton42_Click()
    RetornaData Me.ActiveControl
End Sub

Function RetornaData(Obj As Object)
    For i = 1 To 6
        For J = 1 To 7
            If Botoes(i, J).Name = Obj.Name Then
             Obj_frm.Value = aCalendario(i, J)
frmCalendario.Hide
End If

        Next
    Next
End Function

calendário.jpg

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...