[color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] showaboutme()
frmAbout.Show
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[color=darkblue]Sub[/color] SosanhFormatvaText()
[color=darkblue]Dim[/color] A [color=darkblue]As[/color] [color=darkblue]String[/color], B [color=darkblue]As[/color] [color=darkblue]String[/color], C [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] KQF, KQT
[color=green]'quy dinh trong he thong la dd/MM/yyyy[/color]
[color=green]'************************************************************[/color]
[color=green]'bien A nhap dung quy dinh he thong (control Panel) (hieu la 10/apr/2007)[/color]
A = "10/4/2007"
KQF = Format(A, "dd/mmm/yyyy") [color=green]'-----> KQF = 10/Apr/2007[/color]
MsgBox "String A : " & A & vbCrLf & _
"format(A, dd/mmm/yyyy) " & KQF & vbCrLf & _
"----> Ham Format mac dinh lay theo kieu he thong"
KQT = Application.WorksheetFunction.Text(A, "dd/mmm/yyyy") [color=green]' -----> KQT = 4/Oct/2007[/color]
MsgBox "String A : " & A & vbCrLf & _
"text(A, dd/mmm/yyyy) " & KQT & vbCrLf & _
"----> ham Text hieu la thang truoc ngay sau (MM/dd/yyyy)"
[color=green]'************************************************************[/color]
[color=green]'bien B nhap khong dung quy dinh he thong (control Panel)[/color]
B = "9/13/2007"
KQF = Format(B, "dd/mmm/yyyy") [color=green]' -----> KQF = 13/Sep/2007[/color]
MsgBox "String B : " & B & vbCrLf & _
"format(B,dd/mmm/yyyy) " & KQF & vbCrLf & _
"Truong hop nay ham Format tu dong doi cach hieu bien B"
B = "13/9/2007"
KQT = Application.WorksheetFunction.Text(B, "dd/mmm/yyyy") [color=green]'------> KQT =13/9/2007[/color]
MsgBox "String B : " & B & vbCrLf & _
"text(B,dd/mmm/yyyy) " & KQT & vbCrLf & _
"----> ham Text hieu la thang truoc ngay sau (MM/dd/yyyy)," & vbCrLf & _
" Nen ham Text khong nhan duoc bien B la mot ngay ---> KQt tra ve la String B"
[color=green]'************************************************************[/color]
[color=green]'bien C nhap khong phai la ngay thang[/color]
C = "13/13"
KQF = Format(C, "dd/mmm/yyyy") [color=green]' -----> KQF = 13/13/2007[/color]
MsgBox "String C : " & C & vbCrLf & _
"format(C,dd/mmm/yyyy) " & KQF & vbCrLf & _
"Truong hop nay ham Format tu dong doi cung khong hieu duoc bien C"
KQT = Application.WorksheetFunction.Text(C, "dd/mmm/yyyy") [color=green]'------> KQT =13/13/2007[/color]
MsgBox "String C : " & C & vbCrLf & _
"text(C,dd/mmm/yyyy) " & KQT & vbCrLf & _
"Truuong hop nay ham Text khong nhan duoc bien C la mot ngay ---> KQT tra ve la String C"
[color=darkblue]End[/color] Sub