Detalhes de vba sistema data e hora retorna msgbox

PropriedadeValor
Nome:vba sistema data e hora retorna msgbox
Descricao:

Retorna os formatos de data e hora
Saberexcel - dicas microsoft excel vba macros

Estas funções e declarações do aplicativo microsoft excel vba, retornam os formatos de data 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 testando_formatos_dia_hora()
MsgBox DateCourte, vbInformation, "Saberexcel - site das macros"
MsgBox DateLongue, vbInformation, "Saberexcel - site das macros"
MsgBox FormatoHorario, vbInformation, "Saberexcel - site das macros"
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 FormatoHorario()
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
FormatoHorario = 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

Faça o download do exemplo de planilha microsft excel vba



Nome do arquivo:vba sistema data e hora retorna msgbox.zip
Tamanho: Vazio
Tipo:zip (Tipo de Mime: application/zip)
Autor:SaberExcel
Criado em: 27/11/2010 20:31
Visitas:Todos
Responsavel:Editor
Acessos:930 Acessos
Atualizado em: 27/11/2010 20:31
Site: