Saberexcel - o site das macros
Estas declarações macros e funções do Aplicativo Microsoft Excel VBA, retonam os formatos de data e hora
Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" _
(ByVal Locale As Long, ByVal LCType As Long, _
ByVal lpLCData As String, ByVal cchData As Long) As Long
Sub testar_me()
MsgBox DateCourte
MsgBox DateLongue
MsgBox FormatHoraire
End Sub
Function DateCourte()
Dim tmp$
With Application
tmp = .Substitute(GetParam(&H1F), "d", .International(xlDayCode))
tmp = .Substitute(tmp, "m", .International(xlMonthCode))
tmp = .Substitute(tmp, "y", .International(xlYearCode))
End With
DateCourte = tmp
End Function
Function DateLongue()
Dim tmp$
With Application
tmp = .Substitute(GetParam(&H20), "d", .International(xlDayCode))
tmp = .Substitute(tmp, “m”, .International(xlMonthCode))
tmp = .Substitute(tmp, “y”, .International(xlYearCode))
End With
DateLongue = tmp
End Function
Function FormatHoraire()
Dim tmp$
With Application
tmp = .Substitute(GetParam(&H1003), “h”, .International(xlHourCode))
tmp = .Substitute(tmp, “m”, .International(xlMinuteCode))
tmp = .Substitute(tmp, “s”, .International(xlSecondCode))
End With
FormatHoraire = tmp
End Function
Private Function GetParam(LocalParam As Long) As String
Dim buf As String
buf = Space$(255)
GetLocaleInfo 0, LocalParam, buf, Len(buf)
GetParam = Application.Trim$(Mid$(buf, 1))
End Function
Function SepDec()
SepDec = Application.International(xlDecimalSeparator)
End Function
Function SepMil()
SepMil = Application.International(xlThousandsSeparator)
End Function
Aprenda tudo sobre o Aplicativo Microsoft Excel VBA, sozinho, praticando com os produtos didáticos Saberexcel