23:24 ICT Thứ hai, 27/03/2017
Trang kho học liệu điện tử ngành Giáo dục và Đào tạo Hà Nội

Thống kê truy cập

Đang truy cậpĐang truy cập : 30

Máy chủ tìm kiếm : 3

Khách viếng thăm : 27


Hôm nayHôm nay : 1373

Tháng hiện tạiTháng hiện tại : 36119

Tổng lượt truy cậpTổng lượt truy cập : 2336619

Đăng nhập thành viên

Nộp bài dự thi

Gửi file

Trang nhất » Kho dữ liệu » Kỹ năng CNTT

Một số đoạn code VBA trong Excel (chuyểddoooir Font chữ)
blic changefont_bln As Boolean
Public casekind As Byte
Public keepmyF_bln As Boolean
Public cot As Long
Public socot As Long
Public hang As Long
Public sohang As Long
 
Sub xoahet()
    Workbooks("convertfont3.1.xla").Sheets(1).Range("A1:CA2000").ClearContents
End Sub
 
Function toletter(a As Long)
   If (a - 1) \ 26 <> 0 Then toletter = Chr((a - 1) \ 26 + 64)
   toletter = toletter + Chr((a - 1) Mod 26 + 65)
End Function
Function changecase(ByVal vnstr As String, ByVal casek As Byte)
   Select Case casek
      Case 0: changecase = vnstr
      Case 1: changecase = UPPERUni(vnstr)
      Case 2: changecase = lowerUni(vnstr)
      Case 3: changecase = ProperUni(vnstr)
      Case 4: changecase = UCase(vnstr)
      Case 5: changecase = LCase(vnstr)
      Case 6: changecase = ProperVni(vnstr)
   End Select
End Function
Sub rangeconvert()
Dim i As Long, j As Long
Dim SingleC As Range, activerange As Range
   Application.ScreenUpdating = False
   Application.Calculation = xlCalculationManual
   cot = Selection.Column
   hang = Selection.Row
   socot = Selection.Columns.Count
   sohang = Selection.Rows.Count
   If cot < ActiveSheet.UsedRange.Column Then
      cot = ActiveSheet.UsedRange.Column
   End If
   If hang < ActiveSheet.UsedRange.Row Then
      hang = ActiveSheet.UsedRange.Row
   End If
   If socot > ActiveSheet.UsedRange.Columns.Count Then
      socot = ActiveSheet.UsedRange.Columns.Count
   End If
   If sohang > ActiveSheet.UsedRange.Rows.Count Then
      sohang = ActiveSheet.UsedRange.Rows.Count
   End If
   UserForm1.Show
   
   If keepmyF_bln Then
      Select Case codekind
      Case 1
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = changecase(Range(toletter(i) & j).Formula, casekind)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
      Case 2
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = changecase(Range(toletter(i) & j).Formula, casekind)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
      Case 4
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = VNItoTCVN3(Range(toletter(i) & j).Formula)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = ".vntime"
      Case 5
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = UNICODEtoTCVN3(Range(toletter(i) & j).Formula)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = ".vntime"
      Case 6
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = TCVN3toVNI(Range(toletter(i) & j).Formula)
               st = changecase(st, casekind)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "VNI-times"
      Case 8
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = UNICODEtoVNI(Range(toletter(i) & j).Formula)
               st = changecase(st, casekind)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "VNI-times"
      Case 9
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = TCVN3toUNICODE(Range(toletter(i) & j).Formula)
               st = changecase(st, casekind)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "Arial"
      Case 10
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = VNItoUNICODE(Range(toletter(i) & j).Formula)
               st = changecase(st, casekind)
               Range(toletter(i) & j).Formula = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "Arial"
      End Select
      
   Else
   
      Select Case codekind
      Case 1
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = changecase(Range(toletter(i) & j), casekind)
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
      Case 2
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = changecase(Range(toletter(i) & j), casekind)
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
      Case 4
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = VNItoTCVN3(Range(toletter(i) & j))
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = ".vntime"
      Case 5
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = UNICODEtoTCVN3(Range(toletter(i) & j))
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = ".vntime"
      Case 6
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = TCVN3toVNI(Range(toletter(i) & j))
               st = changecase(st, casekind)
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "VNI-times"
      Case 8
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = UNICODEtoVNI(Range(toletter(i) & j))
               st = changecase(st, casekind)
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "VNI-times"
      Case 9
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = TCVN3toUNICODE(Range(toletter(i) & j))
               st = changecase(st, casekind)
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "Arial"
      Case 10
         For i = cot To cot + socot - 1
            For j = hang To hang + sohang - 1
               st = VNItoUNICODE(Range(toletter(i) & j))
               st = changecase(st, casekind)
               Range(toletter(i) & j) = st
               UserForm1.Caption = (i - cot + 1) * (j - hang + 1) * 100 / (socot * sohang) & " % completed"
            Next j
         Next i
         If changefont_bln Then Selection.Font.Name = "Arial"
      End Select
   End If
   Application.Calculation = xlCalculationAutomatic
   Application.ScreenUpdating = True
   UserForm1.Caption = "Change font code"
End Sub
-----------------------------------------------------------------------------------
Option Explicit
Function TCVN3toVNI(vnstr As String)
Dim c As String, i As Long
   For i = 1 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      Select Case c
         Case "a": c = "a"
         Case "¸": c = "aù"
         Case "µ": c = "aø"
         Case "¶": c = "aû"
         Case "·": c = "aõ"
         Case "¹": c = "aï"
         Case "¨": c = "aê"
         Case "¾": c = "aé"
         Case "»": c = "aè"
         Case "¼": c = "aú"
         Case "½": c = "aü"
         Case "Æ": c = "aë"
         Case "©": c = "aâ"
         Case "Ê": c = "aá"
         Case "Ç": c = "aà"
         Case "È": c = "aå"
         Case "É": c = "aã"
         Case "Ë": c = "aä"
         Case "e": c = "e"
         Case "Ð": c = "eù"
         Case "Ì": c = "eø"
         Case "Î": c = "eû"
         Case "Ï": c = "eõ"
         Case "Ñ": c = "eï"
         Case "ª": c = "eâ"
         Case "Õ": c = "eá"
         Case "Ò": c = "eà"
         Case "Ó": c = "eå"
         Case "Ô": c = "eã"
         Case "Ö": c = "eä"
         Case "o": c = "o"
         Case "ã": c = "où"
         Case "ß": c = "oø"
         Case "á": c = "oû"
         Case "â": c = "oõ"
         Case "ä": c = "oï"
         Case "«": c = "oâ"
         Case "è": c = "oá"
         Case "å": c = "oà"
         Case "æ": c = "oå"
         Case "ç": c = "oã"
         Case "é": c = "oä"
         Case "¬": c = "ô"
         Case "í": c = "ôù"
         Case "ê": c = "ôø"
         Case "ë": c = "ôû"
         Case "ì": c = "ôõ"
         Case "î": c = "ôï"
         Case "i": c = "i"
         Case "Ý": c = "í"
         Case "×": c = "ì"
         Case "Ø": c = "æ"
         Case "Ü": c = "ó"
         Case "Þ": c = "ò"
         Case "u": c = "u"
         Case "ó": c = "uù"
         Case "ï": c = "uø"
         Case "ñ": c = "uû"
         Case "ò": c = "uõ"
         Case "ô": c = "uï"
         Case "­": c = "ö"
         Case "ø": c = "öù"
         Case "õ": c = "uø"
         Case "ö": c = "öû"
         Case "÷": c = "öõ"
         Case "ù": c = "öï"
         Case "y": c = "y"
         Case "ý": c = "yù"
         Case "ú": c = "yø"
         Case "û": c = "yû"
         Case "ü": c = "yõ"
         Case "þ": c = "î"
         Case "®": c = "ñ"
         Case "A": c = "A"
         Case "¡": c = "AÊ"
         Case "¢": c = "AÂ"
         Case "E": c = "E"
         Case "£": c = "EÂ"
         Case "O": c = "O"
         Case "¤": c = "OÂ"
         Case "¥": c = "Ô"
         Case "I": c = "I"
         Case "U": c = "U"
         Case "¦": c = "Ö"
         Case "Y": c = "Y"
         Case "§": c = "Ñ"
      End Select
      TCVN3toVNI = TCVN3toVNI + c
   Next i
End Function
Function TCVN3toUNICODE(vnstr As String)
Dim c As String, i As Long
   For i = 1 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      Select Case c
         Case "a": c = ChrW$(97)
         Case "¸": c = ChrW$(225)
         Case "µ": c = ChrW$(224)
         Case "¶": c = ChrW$(7843)
         Case "·": c = ChrW$(227)
         Case "¹": c = ChrW$(7841)
         Case "¨": c = ChrW$(259)
         Case "¾": c = ChrW$(7855)
         Case "»": c = ChrW$(7857)
         Case "¼": c = ChrW$(7859)
         Case "½": c = ChrW$(7861)
         Case "Æ": c = ChrW$(7863)
         Case "©": c = ChrW$(226)
         Case "Ê": c = ChrW$(7845)
         Case "Ç": c = ChrW$(7847)
         Case "È": c = ChrW$(7849)
         Case "É": c = ChrW$(7851)
         Case "Ë": c = ChrW$(7853)
         Case "e": c = ChrW$(101)
         Case "Ð": c = ChrW$(233)
         Case "Ì": c = ChrW$(232)
         Case "Î": c = ChrW$(7867)
         Case "Ï": c = ChrW$(7869)
         Case "Ñ": c = ChrW$(7865)
         Case "ª": c = ChrW$(234)
         Case "Õ": c = ChrW$(7871)
         Case "Ò": c = ChrW$(7873)
         Case "Ó": c = ChrW$(7875)
         Case "Ô": c = ChrW$(7877)
         Case "Ö": c = ChrW$(7879)
         Case "o": c = ChrW$(111)
         Case "ã": c = ChrW$(243)
         Case "ß": c = ChrW$(242)
         Case "á": c = ChrW$(7887)
         Case "â": c = ChrW$(245)
         Case "ä": c = ChrW$(7885)
         Case "«": c = ChrW$(244)
         Case "è": c = ChrW$(7889)
         Case "å": c = ChrW$(7891)
         Case "æ": c = ChrW$(7893)
         Case "ç": c = ChrW$(7895)
         Case "é": c = ChrW$(7897)
         Case "¬": c = ChrW$(417)
         Case "í": c = ChrW$(7899)
         Case "ê": c = ChrW$(7901)
         Case "ë": c = ChrW$(7903)
         Case "ì": c = ChrW$(7905)
         Case "î": c = ChrW$(7907)
         Case "i": c = ChrW$(105)
         Case "Ý": c = ChrW$(237)
         Case "×": c = ChrW$(236)
         Case "Ø": c = ChrW$(7881)
         Case "Ü": c = ChrW$(297)
         Case "Þ": c = ChrW$(7883)
         Case "u": c = ChrW$(117)
         Case "ó": c = ChrW$(250)
         Case "ï": c = ChrW$(249)
         Case "ñ": c = ChrW$(7911)
         Case "ò": c = ChrW$(361)
         Case "ô": c = ChrW$(7909)
         Case "­": c = ChrW$(432)
         Case "ø": c = ChrW$(7913)
         Case "õ": c = ChrW$(7915)
         Case "ö": c = ChrW$(7917)
         Case "÷": c = ChrW$(7919)
         Case "ù": c = ChrW$(7921)
         Case "y": c = ChrW$(121)
         Case "ý": c = ChrW$(253)
         Case "ú": c = ChrW$(7923)
         Case "û": c = ChrW$(7927)
         Case "ü": c = ChrW$(7929)
         Case "þ": c = ChrW$(7925)
         Case "®": c = ChrW$(273)
         Case "A": c = ChrW$(65)
         Case "¡": c = ChrW$(258)
         Case "¢": c = ChrW$(194)
         Case "E": c = ChrW$(69)
         Case "£": c = ChrW$(202)
         Case "O": c = ChrW$(79)
         Case "¤": c = ChrW$(212)
         Case "¥": c = ChrW$(416)
         Case "I": c = ChrW$(73)
         Case "U": c = ChrW$(85)
         Case "¦": c = ChrW$(431)
         Case "Y": c = ChrW$(89)
         Case "§": c = ChrW$(272)
      End Select
      TCVN3toUNICODE = TCVN3toUNICODE + c
   Next i
End Function
Function UNICODEtoTCVN3(vnstr As String)
Dim c As String, i As Long
   For i = 1 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      Select Case c
         Case ChrW$(97): c = "a"
         Case ChrW$(225): c = "¸"
         Case ChrW$(224): c = "µ"
         Case ChrW$(7843): c = "¶"
         Case ChrW$(227): c = "·"
         Case ChrW$(7841): c = "¹"
         Case ChrW$(259): c = "¨"
         Case ChrW$(7855): c = "¾"
         Case ChrW$(7857): c = "»"
         Case ChrW$(7859): c = "¼"
         Case ChrW$(7861): c = "½"
         Case ChrW$(7863): c = "Æ"
         Case ChrW$(226): c = "©"
         Case ChrW$(7845): c = "Ê"
         Case ChrW$(7847): c = "Ç"
         Case ChrW$(7849): c = "È"
         Case ChrW$(7851): c = "É"
         Case ChrW$(7853): c = "Ë"
         Case ChrW$(101): c = "e"
         Case ChrW$(233): c = "Ð"
         Case ChrW$(232): c = "Ì"
         Case ChrW$(7867): c = "Î"
         Case ChrW$(7869): c = "Ï"
         Case ChrW$(7865): c = "Ñ"
         Case ChrW$(234): c = "ª"
         Case ChrW$(7871): c = "Õ"
         Case ChrW$(7873): c = "Ò"
         Case ChrW$(7875): c = "Ó"
         Case ChrW$(7877): c = "Ô"
         Case ChrW$(7879): c = "Ö"
         Case ChrW$(111): c = "o"
         Case ChrW$(243): c = "ã"
         Case ChrW$(242): c = "ß"
         Case ChrW$(7887): c = "á"
         Case ChrW$(245): c = "â"
         Case ChrW$(7885): c = "ä"
         Case ChrW$(244): c = "«"
         Case ChrW$(7889): c = "è"
         Case ChrW$(7891): c = "å"
         Case ChrW$(7893): c = "æ"
         Case ChrW$(7895): c = "ç"
         Case ChrW$(7897): c = "é"
         Case ChrW$(417): c = "¬"
         Case ChrW$(7899): c = "í"
         Case ChrW$(7901): c = "ê"
         Case ChrW$(7903): c = "ë"
         Case ChrW$(7905): c = "ì"
         Case ChrW$(7907): c = "î"
         Case ChrW$(105): c = "i"
         Case ChrW$(237): c = "Ý"
         Case ChrW$(236): c = "×"
         Case ChrW$(7881): c = "Ø"
         Case ChrW$(297): c = "Ü"
         Case ChrW$(7883): c = "Þ"
         Case ChrW$(117): c = "u"
         Case ChrW$(250): c = "ó"
         Case ChrW$(249): c = "ï"
         Case ChrW$(7911): c = "ñ"
         Case ChrW$(361): c = "ò"
         Case ChrW$(7909): c = "ô"
         Case ChrW$(432): c = "­"
         Case ChrW$(7913): c = "ø"
         Case ChrW$(7915): c = "õ"
         Case ChrW$(7917): c = "ö"
         Case ChrW$(7919): c = "÷"
         Case ChrW$(7921): c = "ù"
         Case ChrW$(121): c = "y"
         Case ChrW$(253): c = "ý"
         Case ChrW$(7923): c = "ú"
         Case ChrW$(7927): c = "û"
         Case ChrW$(7929): c = "ü"
         Case ChrW$(7925): c = "þ"
         Case ChrW$(273): c = "®"
         Case ChrW$(65): c = "A"
         Case ChrW$(193): c = "¸"
         Case ChrW$(192): c = "µ"
         Case ChrW$(7842): c = "¶"
         Case ChrW$(195): c = "·"
         Case ChrW$(7840): c = "¹"
         Case ChrW$(258): c = "¡"
         Case ChrW$(7854): c = "¾"
         Case ChrW$(7856): c = "»"
         Case ChrW$(7858): c = "¼"
         Case ChrW$(7860): c = "½"
         Case ChrW$(7862): c = "Æ"
         Case ChrW$(194): c = "¢"
         Case ChrW$(7844): c = "Ê"
         Case ChrW$(7846): c = "Ç"
         Case ChrW$(7848): c = "È"
         Case ChrW$(7850): c = "É"
         Case ChrW$(7852): c = "Ë"
         Case ChrW$(69): c = "E"
         Case ChrW$(201): c = "Ð"
         Case ChrW$(200): c = "Ì"
         Case ChrW$(7866): c = "Î"
         Case ChrW$(7868): c = "Ï"
         Case ChrW$(7864): c = "Ñ"
         Case ChrW$(202): c = "£"
         Case ChrW$(7870): c = "Õ"
         Case ChrW$(7872): c = "Ò"
         Case ChrW$(7874): c = "Ó"
         Case ChrW$(7876): c = "Ô"
         Case ChrW$(7878): c = "Ö"
         Case ChrW$(79): c = "O"
         Case ChrW$(211): c = "ã"
         Case ChrW$(210): c = "ß"
         Case ChrW$(7886): c = "á"
         Case ChrW$(213): c = "â"
         Case ChrW$(7884): c = "ä"
         Case ChrW$(212): c = "¤"
         Case ChrW$(7888): c = "è"
         Case ChrW$(7890): c = "å"
         Case ChrW$(7892): c = "æ"
         Case ChrW$(7894): c = "ç"
         Case ChrW$(7896): c = "é"
         Case ChrW$(416): c = "¥"
         Case ChrW$(7898): c = "í"
         Case ChrW$(7900): c = "ê"
         Case ChrW$(7902): c = "ë"
         Case ChrW$(7904): c = "ì"
         Case ChrW$(7906): c = "î"
         Case ChrW$(73): c = "I"
         Case ChrW$(205): c = "Ý"
         Case ChrW$(204): c = "×"
         Case ChrW$(7880): c = "Ø"
         Case ChrW$(296): c = "Ü"
         Case ChrW$(7882): c = "Þ"
         Case ChrW$(85): c = "U"
         Case ChrW$(218): c = "ó"
         Case ChrW$(217): c = "ï"
         Case ChrW$(7910): c = "ñ"
         Case ChrW$(360): c = "ò"
         Case ChrW$(7908): c = "ô"
         Case ChrW$(431): c = "¦"
         Case ChrW$(7912): c = "ø"
         Case ChrW$(7914): c = "õ"
         Case ChrW$(7916): c = "ö"
         Case ChrW$(7918): c = "÷"
         Case ChrW$(7920): c = "ù"
         Case ChrW$(89): c = "Y"
         Case ChrW$(221): c = "ý"
         Case ChrW$(7922): c = "ú"
         Case ChrW$(7926): c = "û"
         Case ChrW$(7928): c = "ü"
         Case ChrW$(7924): c = "þ"
         Case ChrW$(272): c = "§"
      End Select
      UNICODEtoTCVN3 = UNICODEtoTCVN3 + c
   Next i
End Function
Function UNICODEtoVNI(vnstr As String)
Dim c As String, i As Long
   For i = 1 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      Select Case c
         Case ChrW$(97): c = "a"
         Case ChrW$(225): c = "aù"
         Case ChrW$(224): c = "aø"
         Case ChrW$(7843): c = "aû"
         Case ChrW$(227): c = "aõ"
         Case ChrW$(7841): c = "aï"
         Case ChrW$(259): c = "aê"
         Case ChrW$(7855): c = "aé"
         Case ChrW$(7857): c = "aè"
         Case ChrW$(7859): c = "aú"
         Case ChrW$(7861): c = "aü"
         Case ChrW$(7863): c = "aë"
         Case ChrW$(226): c = "aâ"
         Case ChrW$(7845): c = "aá"
         Case ChrW$(7847): c = "aà"
         Case ChrW$(7849): c = "aå"
         Case ChrW$(7851): c = "aã"
         Case ChrW$(7853): c = "aä"
         Case ChrW$(101): c = "e"
         Case ChrW$(233): c = "eù"
         Case ChrW$(232): c = "eø"
         Case ChrW$(7867): c = "eû"
         Case ChrW$(7869): c = "eõ"
         Case ChrW$(7865): c = "eï"
         Case ChrW$(234): c = "eâ"
         Case ChrW$(7871): c = "eá"
         Case ChrW$(7873): c = "eà"
         Case ChrW$(7875): c = "eå"
         Case ChrW$(7877): c = "eã"
         Case ChrW$(7879): c = "eä"
         Case ChrW$(111): c = "o"
         Case ChrW$(243): c = "où"
         Case ChrW$(242): c = "oø"
         Case ChrW$(7887): c = "oû"
         Case ChrW$(245): c = "oõ"
         Case ChrW$(7885): c = "oï"
         Case ChrW$(244): c = "oâ"
         Case ChrW$(7889): c = "oá"
         Case ChrW$(7891): c = "oà"
         Case ChrW$(7893): c = "oå"
         Case ChrW$(7895): c = "oã"
         Case ChrW$(7897): c = "oä"
         Case ChrW$(417): c = "ô"
         Case ChrW$(7899): c = "ôù"
         Case ChrW$(7901): c = "ôø"
         Case ChrW$(7903): c = "ôû"
         Case ChrW$(7905): c = "ôõ"
         Case ChrW$(7907): c = "ôï"
         Case ChrW$(105): c = "i"
         Case ChrW$(237): c = "í"
         Case ChrW$(236): c = "ì"
         Case ChrW$(7881): c = "æ"
         Case ChrW$(297): c = "ó"
         Case ChrW$(7883): c = "ò"
         Case ChrW$(117): c = "u"
         Case ChrW$(250): c = "uù"
         Case ChrW$(249): c = "uø"
         Case ChrW$(7911): c = "uû"
         Case ChrW$(361): c = "uõ"
         Case ChrW$(7909): c = "uï"
         Case ChrW$(432): c = "ö"
         Case ChrW$(7913): c = "öù"
         Case ChrW$(7915): c = "uø"
         Case ChrW$(7917): c = "öû"
         Case ChrW$(7919): c = "öõ"
         Case ChrW$(7921): c = "öï"
         Case ChrW$(121): c = "y"
         Case ChrW$(253): c = "yù"
         Case ChrW$(7923): c = "yø"
         Case ChrW$(7927): c = "yû"
         Case ChrW$(7929): c = "yõ"
         Case ChrW$(7925): c = "î"
         Case ChrW$(273): c = "ñ"
         Case ChrW$(65): c = "A"
         Case ChrW$(193): c = "AÙ"
         Case ChrW$(192): c = "AØ"
         Case ChrW$(7842): c = "AÛ"
         Case ChrW$(195): c = "AÕ"
         Case ChrW$(7840): c = "AÏ"
         Case ChrW$(258): c = "AÊ"
         Case ChrW$(7854): c = "AÉ"
         Case ChrW$(7856): c = "AÈ"
         Case ChrW$(7858): c = "AÚ"
         Case ChrW$(7860): c = "AÜ"
         Case ChrW$(7862): c = "AË"
         Case ChrW$(194): c = "AÂ"
         Case ChrW$(7844): c = "AÁ"
         Case ChrW$(7846): c = "AÀ"
         Case ChrW$(7848): c = "AÅ"
         Case ChrW$(7850): c = "AÃ"
         Case ChrW$(7852): c = "AÄ"
         Case ChrW$(69): c = "E"
         Case ChrW$(201): c = "EÙ"
         Case ChrW$(200): c = "EØ"
         Case ChrW$(7866): c = "EÛ"
         Case ChrW$(7868): c = "EÕ"
         Case ChrW$(7864): c = "EÏ"
         Case ChrW$(202): c = "EÂ"
         Case ChrW$(7870): c = "EÁ"
         Case ChrW$(7872): c = "EÀ"
         Case ChrW$(7874): c = "EÅ"
         Case ChrW$(7876): c = "EÃ"
         Case ChrW$(7878): c = "EÄ"
         Case ChrW$(79): c = "O"
         Case ChrW$(211): c = "OÙ"
         Case ChrW$(210): c = "OØ"
         Case ChrW$(7886): c = "OÛ"
         Case ChrW$(213): c = "OÕ"
         Case ChrW$(7884): c = "OÏ"
         Case ChrW$(212): c = "OÂ"
         Case ChrW$(7888): c = "OÁ"
         Case ChrW$(7890): c = "OÀ"
         Case ChrW$(7892): c = "OÅ"
         Case ChrW$(7894): c = "OÃ"
         Case ChrW$(7896): c = "OÄ"
         Case ChrW$(416): c = "Ô"
         Case ChrW$(7898): c = "ÔÙ"
         Case ChrW$(7900): c = "ÔØ"
         Case ChrW$(7902): c = "ÔÛ"
         Case ChrW$(7904): c = "ÔÕ"
         Case ChrW$(7906): c = "ÔÏ"
         Case ChrW$(73): c = "I"
         Case ChrW$(205): c = "Í"
         Case ChrW$(204): c = "Ì"
         Case ChrW$(7880): c = "Æ"
         Case ChrW$(296): c = "Ó"
         Case ChrW$(7882): c = "Ò"
         Case ChrW$(85): c = "U"
         Case ChrW$(218): c = "UÙ"
         Case ChrW$(217): c = "UØ"
         Case ChrW$(7910): c = "UÛ"
         Case ChrW$(360): c = "UÕ"
         Case ChrW$(7908): c = "UÏ"
         Case ChrW$(431): c = "Ö"
         Case ChrW$(7912): c = "ÖÙ"
         Case ChrW$(7914): c = "ÖØ"
         Case ChrW$(7916): c = "ÖÛ"
         Case ChrW$(7918): c = "ÖÕ"
         Case ChrW$(7920): c = "ÖÏ"
         Case ChrW$(89): c = "Y"
         Case ChrW$(221): c = "YÙ"
         Case ChrW$(7922): c = "YØ"
         Case ChrW$(7926): c = "YÛ"
         Case ChrW$(7928): c = "YÕ"
         Case ChrW$(7924): c = "Î"
         Case ChrW$(272): c = "Ñ"
      End Select
      UNICODEtoVNI = UNICODEtoVNI + c
   Next i
End Function
 
Function VNItoUNICODE(vnstr As String)
Dim c As String, i As Long
Dim db As Boolean
   For i = 1 To Len(vnstr)
      db = False
      If i < Len(vnstr) Then
         c = Mid(vnstr, i + 1, 1)
         If c = "ù" Or c = "ø" Or c = "û" Or c = "õ" Or c = "ï" Or _
            c = "ê" Or c = "é" Or c = "è" Or c = "ú" Or c = "ü" Or c = "ë" Or _
            c = "â" Or c = "á" Or c = "à" Or c = "å" Or c = "ã" Or c = "ä" Or _
            c = "Ù" Or c = "Ø" Or c = "Û" Or c = "Õ" Or c = "Ï" Or _
            c = "Ê" Or c = "É" Or c = "È" Or c = "Ú" Or c = "Ü" Or c = "Ë" Or _
            c = "Â" Or c = "Á" Or c = "À" Or c = "Å" Or c = "Ã" Or c = "Ä" Then db = True
      End If
      If db Then
         c = Mid(vnstr, i, 2)
         Select Case c
            Case "aù": c = ChrW$(225)
            Case "aø": c = ChrW$(224)
            Case "aû": c = ChrW$(7843)
            Case "aõ": c = ChrW$(227)
            Case "aï": c = ChrW$(7841)
            Case "aê": c = ChrW$(259)
            Case "aé": c = ChrW$(7855)
            Case "aè": c = ChrW$(7857)
            Case "aú": c = ChrW$(7859)
            Case "aü": c = ChrW$(7861)
            Case "aë": c = ChrW$(7863)
            Case "aâ": c = ChrW$(226)
            Case "aá": c = ChrW$(7845)
            Case "aà": c = ChrW$(7847)
            Case "aå": c = ChrW$(7849)
            Case "aã": c = ChrW$(7851)
            Case "aä": c = ChrW$(7853)
            Case "eù": c = ChrW$(233)
            Case "eø": c = ChrW$(232)
            Case "eû": c = ChrW$(7867)
            Case "eõ": c = ChrW$(7869)
            Case "eï": c = ChrW$(7865)
            Case "eâ": c = ChrW$(234)
            Case "eá": c = ChrW$(7871)
            Case "eà": c = ChrW$(7873)
            Case "eå": c = ChrW$(7875)
            Case "eã": c = ChrW$(7877)
            Case "eä": c = ChrW$(7879)
            Case "où": c = ChrW$(243)
            Case "oø": c = ChrW$(242)
            Case "oû": c = ChrW$(7887)
            Case "oõ": c = ChrW$(245)
            Case "oï": c = ChrW$(7885)
            Case "oâ": c = ChrW$(244)
            Case "oá": c = ChrW$(7889)
            Case "oà": c = ChrW$(7891)
            Case "oå": c = ChrW$(7893)
            Case "oã": c = ChrW$(7895)
            Case "oä": c = ChrW$(7897)
            Case "ôù": c = ChrW$(7899)
            Case "ôø": c = ChrW$(7901)
            Case "ôû": c = ChrW$(7903)
            Case "ôõ": c = ChrW$(7905)
            Case "ôï": c = ChrW$(7907)
            Case "uù": c = ChrW$(250)
            Case "uø": c = ChrW$(249)
            Case "uû": c = ChrW$(7911)
            Case "uõ": c = ChrW$(361)
            Case "uï": c = ChrW$(7909)
            Case "öù": c = ChrW$(7913)
            Case "öø": c = ChrW$(7915)
            Case "öû": c = ChrW$(7917)
            Case "öõ": c = ChrW$(7919)
            Case "öï": c = ChrW$(7921)
            Case "yù": c = ChrW$(253)
            Case "yø": c = ChrW$(7923)
            Case "yû": c = ChrW$(7927)
            Case "yõ": c = ChrW$(7929)
            Case "AÙ": c = ChrW$(193)
            Case "AØ": c = ChrW$(192)
            Case "AÛ": c = ChrW$(7842)
            Case "AÕ": c = ChrW$(195)
            Case "AÏ": c = ChrW$(7840)
            Case "AÊ": c = ChrW$(258)
            Case "AÉ": c = ChrW$(7854)
            Case "AÈ": c = ChrW$(7856)
            Case "AÚ": c = ChrW$(7858)
            Case "AÜ": c = ChrW$(7860)
            Case "AË": c = ChrW$(7862)
            Case "AÂ": c = ChrW$(194)
            Case "AÁ": c = ChrW$(7844)
            Case "AÀ": c = ChrW$(7846)
            Case "AÅ": c = ChrW$(7848)
            Case "AÃ": c = ChrW$(7850)
            Case "AÄ": c = ChrW$(7852)
            Case "EÙ": c = ChrW$(201)
            Case "EØ": c = ChrW$(200)
            Case "EÛ": c = ChrW$(7866)
            Case "EÕ": c = ChrW$(7868)
            Case "EÏ": c = ChrW$(7864)
            Case "EÂ": c = ChrW$(202)
            Case "EÁ": c = ChrW$(7870)
            Case "EÀ": c = ChrW$(7872)
            Case "EÅ": c = ChrW$(7874)
            Case "EÃ": c = ChrW$(7876)
            Case "EÄ": c = ChrW$(7878)
            Case "OÙ": c = ChrW$(211)
            Case "OØ": c = ChrW$(210)
            Case "OÛ": c = ChrW$(7886)
            Case "OÕ": c = ChrW$(213)
            Case "OÏ": c = ChrW$(7884)
            Case "OÂ": c = ChrW$(212)
            Case "OÁ": c = ChrW$(7888)
            Case "OÀ": c = ChrW$(7890)
            Case "OÅ": c = ChrW$(7892)
            Case "OÃ": c = ChrW$(7894)
            Case "OÄ": c = ChrW$(7896)
            Case "ÔÙ": c = ChrW$(7898)
            Case "ÔØ": c = ChrW$(7900)
            Case "ÔÛ": c = ChrW$(7902)
            Case "ÔÕ": c = ChrW$(7904)
            Case "ÔÏ": c = ChrW$(7906)
            Case "UÙ": c = ChrW$(218)
            Case "UØ": c = ChrW$(217)
            Case "UÛ": c = ChrW$(7910)
            Case "UÕ": c = ChrW$(360)
            Case "UÏ": c = ChrW$(7908)
            Case "ÖÙ": c = ChrW$(7912)
            Case "ÖØ": c = ChrW$(7914)
            Case "ÖÛ": c = ChrW$(7916)
            Case "ÖÕ": c = ChrW$(7918)
            Case "ÖÏ": c = ChrW$(7920)
            Case "YÙ": c = ChrW$(221)
            Case "YØ": c = ChrW$(7922)
            Case "YÛ": c = ChrW$(7926)
            Case "YÕ": c = ChrW$(7928)
         End Select
      Else
         c = Mid(vnstr, i, 1)
         Select Case c
            Case "ô": c = ChrW$(417)
            Case "í": c = ChrW$(237)
            Case "ì": c = ChrW$(236)
            Case "æ": c = ChrW$(7881)
            Case "ó": c = ChrW$(297)
            Case "ò": c = ChrW$(7883)
            Case "ö": c = ChrW$(432)
            Case "î": c = ChrW$(7925)
            Case "ñ": c = ChrW$(273)
            Case "Ô": c = ChrW$(416)
            Case "Í": c = ChrW$(205)
            Case "Ì": c = ChrW$(204)
            Case "Æ": c = ChrW$(7880)
            Case "Ó": c = ChrW$(296)
            Case "Ò": c = ChrW$(7882)
            Case "Ö": c = ChrW$(431)
            Case "Î": c = ChrW$(7924)
            Case "Ñ": c = ChrW$(272)
         End Select
      End If
      VNItoUNICODE = VNItoUNICODE + c
      If db Then i = i + 1
   Next i
End Function
Function VNItoTCVN3(vnstr As String)
Dim c As String, i As Long
Dim db As Boolean
   For i = 1 To Len(vnstr)
      db = False
      If i < Len(vnstr) Then
         c = Mid(vnstr, i + 1, 1)
         If c = "ù" Or c = "ø" Or c = "û" Or c = "õ" Or c = "ï" Or _
            c = "ê" Or c = "é" Or c = "è" Or c = "ú" Or c = "ü" Or c = "ë" Or _
            c = "â" Or c = "á" Or c = "à" Or c = "å" Or c = "ã" Or c = "ä" Or _
            c = "Ù" Or c = "Ø" Or c = "Û" Or c = "Õ" Or c = "Ï" Or _
            c = "Ê" Or c = "É" Or c = "È" Or c = "Ú" Or c = "Ü" Or c = "Ë" Or _
            c = "Â" Or c = "Á" Or c = "À" Or c = "Å" Or c = "Ã" Or c = "Ä" Then db = True
      End If
      If db Then
         c = Mid(vnstr, i, 2)
         Select Case c
            Case "aù": c = "¸"
            Case "aø": c = "µ"
            Case "aû": c = "¶"
            Case "aõ": c = "·"
            Case "aï": c = "¹"
            Case "aê": c = "¨"
            Case "aé": c = "¾"
            Case "aè": c = "»"
            Case "aú": c = "¼"
            Case "aü": c = "½"
            Case "aë": c = "Æ"
            Case "aâ": c = "©"
            Case "aá": c = "Ê"
            Case "aà": c = "Ç"
            Case "aå": c = "È"
            Case "aã": c = "É"
            Case "aä": c = "Ë"
            Case "eù": c = "Ð"
            Case "eø": c = "Ì"
            Case "eû": c = "Î"
            Case "eõ": c = "Ï"
            Case "eï": c = "Ñ"
            Case "eâ": c = "ª"
            Case "eá": c = "Õ"
            Case "eà": c = "Ò"
            Case "eå": c = "Ó"
            Case "eã": c = "Ô"
            Case "eä": c = "Ö"
            Case "où": c = "ã"
            Case "oø": c = "ß"
            Case "oû": c = "á"
            Case "oõ": c = "â"
            Case "oï": c = "ä"
            Case "oâ": c = "«"
            Case "oá": c = "è"
            Case "oà": c = "å"
            Case "oå": c = "æ"
            Case "oã": c = "ç"
            Case "oä": c = "é"
            Case "ôù": c = "í"
            Case "ôø": c = "ê"
            Case "ôû": c = "ë"
            Case "ôõ": c = "ì"
            Case "ôï": c = "î"
            Case "uù": c = "ó"
            Case "uø": c = "ï"
            Case "uû": c = "ñ"
            Case "uõ": c = "ò"
            Case "uï": c = "ô"
            Case "öù": c = "ø"
            Case "öø": c = "õ"
            Case "öû": c = "ö"
            Case "öõ": c = "÷"
            Case "öï": c = "ù"
            Case "yù": c = "ý"
            Case "yø": c = "ú"
            Case "yû": c = "û"
            Case "yõ": c = "ü"
            Case "AÙ": c = "¸"
            Case "AØ": c = "µ"
            Case "AÛ": c = "¶"
            Case "AÕ": c = "·"
            Case "AÏ": c = "¹"
            Case "AÉ": c = "¾"
            Case "AÈ": c = "»"
            Case "AÚ": c = "¼"
            Case "AÜ": c = "½"
            Case "AË": c = "Æ"
            Case "AÁ": c = "Ê"
            Case "AÀ": c = "Ç"
            Case "AÅ": c = "È"
            Case "AÃ": c = "É"
            Case "AÄ": c = "Ë"
            Case "EÙ": c = "Ð"
            Case "EØ": c = "Ì"
            Case "EÛ": c = "Î"
            Case "EÕ": c = "Ï"
            Case "EÏ": c = "Ñ"
            Case "EÁ": c = "Õ"
            Case "EÀ": c = "Ò"
            Case "EÅ": c = "Ó"
            Case "EÃ": c = "Ô"
            Case "EÄ": c = "Ö"
            Case "OÙ": c = "ã"
            Case "OØ": c = "ß"
            Case "OÛ": c = "á"
            Case "OÕ": c = "â"
            Case "OÏ": c = "ä"
            Case "OÁ": c = "è"
            Case "OÀ": c = "å"
            Case "OÅ": c = "æ"
            Case "OÃ": c = "ç"
            Case "OÄ": c = "é"
            Case "ÔÙ": c = "í"
            Case "ÔØ": c = "ê"
            Case "ÔÛ": c = "ë"
            Case "ÔÕ": c = "ì"
            Case "ÔÏ": c = "î"
            Case "UÙ": c = "ó"
            Case "UØ": c = "ï"
            Case "UÛ": c = "ñ"
            Case "UÕ": c = "ò"
            Case "UÏ": c = "ô"
            Case "ÖÙ": c = "ø"
            Case "ÖØ": c = "õ"
            Case "ÖÛ": c = "ö"
            Case "ÖÕ": c = "÷"
            Case "ÖÏ": c = "ù"
            Case "YÙ": c = "ý"
            Case "YØ": c = "ú"
            Case "YÛ": c = "û"
            Case "YÕ": c = "ü"
            Case "AÊ": c = "¡"
            Case "AÂ": c = "¢"
            Case "EÂ": c = "£"
            Case "OÂ": c = "¤"
         End Select
      Else
         c = Mid(vnstr, i, 1)
         Select Case c
            Case "ô": c = "¬"
            Case "i": c = "i"
            Case "í": c = "Ý"
            Case "ì": c = "×"
            Case "æ": c = "Ø"
            Case "ó": c = "Ü"
            Case "ò": c = "Þ"
            Case "ö": c = "­"
            Case "î": c = "þ"
            Case "ñ": c = "®"
            Case "A": c = "A"
            Case "Ô": c = "¥"
            Case "I": c = "I"
            Case "Í": c = "Æ"
            Case "Ý": c = "Ø"
            Case "U": c = "U"
            Case "Ö": c = "¦"
            Case "Y": c = "Y"
            Case "Ñ": c = "§"
         End Select
      End If
      VNItoTCVN3 = VNItoTCVN3 + c
      If db Then i = i + 1
   Next i
End Function
Function TCVN3fromVNI(vnstr As String)
   TCVN3fromVNI = VNItoTCVN3(vnstr)
End Function
Function TCVN3fromUNICODE(vnstr As String)
   TCVN3fromUNICODE = UNICODEtoTCVN3(vnstr)
End Function
Function VNIfromTCVN3(vnstr As String)
   VNIfromTCVN3 = TCVN3toVNI(vnstr)
End Function
Function VNIfromUNICODE(vnstr As String)
   VNIfromUNICODE = UNICODEtoVNI(vnstr)
End Function
Function UNICODEfromVNI(vnstr As String)
   UNICODEfromVNI = VNItoUNICODE(vnstr)
End Function
Function UNICODEfromTCVN3(vnstr As String)
   UNICODEfromTCVN3 = TCVN3toUNICODE(vnstr)
End Function
Function UPPERUni(ByVal vnstr As String)
Dim c As String, i As Long
   vnstr = UCase(vnstr)
   For i = 1 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      Select Case c
         Case ChrW$(97): c = ChrW$(65)
         Case ChrW$(225): c = ChrW$(193)
         Case ChrW$(224): c = ChrW$(192)
         Case ChrW$(7843): c = ChrW$(7842)
         Case ChrW$(227): c = ChrW$(195)
         Case ChrW$(7841): c = ChrW$(7840)
         Case ChrW$(259): c = ChrW$(258)
         Case ChrW$(7855): c = ChrW$(7854)
         Case ChrW$(7857): c = ChrW$(7856)
         Case ChrW$(7859): c = ChrW$(7858)
         Case ChrW$(7861): c = ChrW$(7860)
         Case ChrW$(7863): c = ChrW$(7862)
         Case ChrW$(226): c = ChrW$(194)
         Case ChrW$(7845): c = ChrW$(7844)
         Case ChrW$(7847): c = ChrW$(7846)
         Case ChrW$(7849): c = ChrW$(7848)
         Case ChrW$(7851): c = ChrW$(7850)
         Case ChrW$(7853): c = ChrW$(7852)
         Case ChrW$(101): c = ChrW$(69)
         Case ChrW$(233): c = ChrW$(201)
         Case ChrW$(232): c = ChrW$(200)
         Case ChrW$(7867): c = ChrW$(7866)
         Case ChrW$(7869): c = ChrW$(7868)
         Case ChrW$(7865): c = ChrW$(7864)
         Case ChrW$(234): c = ChrW$(202)
         Case ChrW$(7871): c = ChrW$(7870)
         Case ChrW$(7873): c = ChrW$(7872)
         Case ChrW$(7875): c = ChrW$(7874)
         Case ChrW$(7877): c = ChrW$(7876)
         Case ChrW$(7879): c = ChrW$(7878)
         Case ChrW$(111): c = ChrW$(79)
         Case ChrW$(243): c = ChrW$(211)
         Case ChrW$(242): c = ChrW$(210)
         Case ChrW$(7887): c = ChrW$(7886)
         Case ChrW$(245): c = ChrW$(213)
         Case ChrW$(7885): c = ChrW$(7884)
         Case ChrW$(244): c = ChrW$(212)
         Case ChrW$(7889): c = ChrW$(7888)
         Case ChrW$(7891): c = ChrW$(7890)
         Case ChrW$(7893): c = ChrW$(7892)
         Case ChrW$(7895): c = ChrW$(7894)
         Case ChrW$(7897): c = ChrW$(7896)
         Case ChrW$(417): c = ChrW$(416)
         Case ChrW$(7899): c = ChrW$(7898)
         Case ChrW$(7901): c = ChrW$(7900)
         Case ChrW$(7903): c = ChrW$(7902)
         Case ChrW$(7905): c = ChrW$(7904)
         Case ChrW$(7907): c = ChrW$(7906)
         Case ChrW$(105): c = ChrW$(73)
         Case ChrW$(237): c = ChrW$(205)
         Case ChrW$(236): c = ChrW$(204)
         Case ChrW$(7881): c = ChrW$(7880)
         Case ChrW$(297): c = ChrW$(296)
         Case ChrW$(7883): c = ChrW$(7882)
         Case ChrW$(117): c = ChrW$(85)
         Case ChrW$(250): c = ChrW$(218)
         Case ChrW$(249): c = ChrW$(217)
         Case ChrW$(7911): c = ChrW$(7910)
         Case ChrW$(361): c = ChrW$(360)
         Case ChrW$(7909): c = ChrW$(7908)
         Case ChrW$(432): c = ChrW$(431)
         Case ChrW$(7913): c = ChrW$(7912)
         Case ChrW$(7915): c = ChrW$(7914)
         Case ChrW$(7917): c = ChrW$(7916)
         Case ChrW$(7919): c = ChrW$(7918)
         Case ChrW$(7921): c = ChrW$(7920)
         Case ChrW$(121): c = ChrW$(89)
         Case ChrW$(253): c = ChrW$(221)
         Case ChrW$(7923): c = ChrW$(7922)
         Case ChrW$(7927): c = ChrW$(7926)
         Case ChrW$(7929): c = ChrW$(7928)
         Case ChrW$(7925): c = ChrW$(7924)
         Case ChrW$(273): c = ChrW$(272)
      End Select
   Next i
   UPPERUni = vnstr
End Function
Function lowerUni(ByVal vnstr As String)
Dim c As String, i As Long
   vnstr = LCase(vnstr)
   For i = 1 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      Select Case c
         Case ChrW$(97): c = ChrW$(65)
         Case ChrW$(225): c = ChrW$(193)
         Case ChrW$(224): c = ChrW$(192)
         Case ChrW$(7843): c = ChrW$(7842)
         Case ChrW$(227): c = ChrW$(195)
         Case ChrW$(7841): c = ChrW$(7840)
         Case ChrW$(259): c = ChrW$(258)
         Case ChrW$(7855): c = ChrW$(7854)
         Case ChrW$(7857): c = ChrW$(7856)
         Case ChrW$(7859): c = ChrW$(7858)
         Case ChrW$(7861): c = ChrW$(7860)
         Case ChrW$(7863): c = ChrW$(7862)
         Case ChrW$(226): c = ChrW$(194)
         Case ChrW$(7845): c = ChrW$(7844)
         Case ChrW$(7847): c = ChrW$(7846)
         Case ChrW$(7849): c = ChrW$(7848)
         Case ChrW$(7851): c = ChrW$(7850)
         Case ChrW$(7853): c = ChrW$(7852)
         Case ChrW$(101): c = ChrW$(69)
         Case ChrW$(233): c = ChrW$(201)
         Case ChrW$(232): c = ChrW$(200)
         Case ChrW$(7867): c = ChrW$(7866)
         Case ChrW$(7869): c = ChrW$(7868)
         Case ChrW$(7865): c = ChrW$(7864)
         Case ChrW$(234): c = ChrW$(202)
         Case ChrW$(7871): c = ChrW$(7870)
         Case ChrW$(7873): c = ChrW$(7872)
         Case ChrW$(7875): c = ChrW$(7874)
         Case ChrW$(7877): c = ChrW$(7876)
         Case ChrW$(7879): c = ChrW$(7878)
         Case ChrW$(111): c = ChrW$(79)
         Case ChrW$(243): c = ChrW$(211)
         Case ChrW$(242): c = ChrW$(210)
         Case ChrW$(7887): c = ChrW$(7886)
         Case ChrW$(245): c = ChrW$(213)
         Case ChrW$(7885): c = ChrW$(7884)
         Case ChrW$(244): c = ChrW$(212)
         Case ChrW$(7889): c = ChrW$(7888)
         Case ChrW$(7891): c = ChrW$(7890)
         Case ChrW$(7893): c = ChrW$(7892)
         Case ChrW$(7895): c = ChrW$(7894)
         Case ChrW$(7897): c = ChrW$(7896)
         Case ChrW$(417): c = ChrW$(416)
         Case ChrW$(7899): c = ChrW$(7898)
         Case ChrW$(7901): c = ChrW$(7900)
         Case ChrW$(7903): c = ChrW$(7902)
         Case ChrW$(7905): c = ChrW$(7904)
         Case ChrW$(7907): c = ChrW$(7906)
         Case ChrW$(105): c = ChrW$(73)
         Case ChrW$(237): c = ChrW$(205)
         Case ChrW$(236): c = ChrW$(204)
         Case ChrW$(7881): c = ChrW$(7880)
         Case ChrW$(297): c = ChrW$(296)
         Case ChrW$(7883): c = ChrW$(7882)
         Case ChrW$(117): c = ChrW$(85)
         Case ChrW$(250): c = ChrW$(218)
         Case ChrW$(249): c = ChrW$(217)
         Case ChrW$(7911): c = ChrW$(7910)
         Case ChrW$(361): c = ChrW$(360)
         Case ChrW$(7909): c = ChrW$(7908)
         Case ChrW$(432): c = ChrW$(431)
         Case ChrW$(7913): c = ChrW$(7912)
         Case ChrW$(7915): c = ChrW$(7914)
         Case ChrW$(7917): c = ChrW$(7916)
         Case ChrW$(7919): c = ChrW$(7918)
         Case ChrW$(7921): c = ChrW$(7920)
         Case ChrW$(121): c = ChrW$(89)
         Case ChrW$(253): c = ChrW$(221)
         Case ChrW$(7923): c = ChrW$(7922)
         Case ChrW$(7927): c = ChrW$(7926)
         Case ChrW$(7929): c = ChrW$(7928)
         Case ChrW$(7925): c = ChrW$(7924)
         Case ChrW$(273): c = ChrW$(272)
      End Select
   Next i
   lowerUni = vnstr
End Function
Function ProperUni(ByVal vnstr As String)
Dim c As String, i As Long
   vnstr = lowerUni(vnstr)
   For i = 1 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      If i = 1 Then
         c = UPPERUni(c)
      Else
         If Mid(vnstr, i - 1, 1) = " " Then
            c = UPPERUni(c)
         End If
      End If
   ProperUni = ProperUni & c
   Next i
   If Len(vnstr) = 0 Then ProperUni = ""
End Function
Function ProperVni(ByVal vnstr As String)
Dim c As String, i As Long
   vnstr = ProperUni(vnstr)
   If Len(vnstr) >= 1 Then ProperVni = UCase(Left(vnstr, 1))
   For i = 2 To Len(vnstr)
      c = Mid(vnstr, i, 1)
      If ((c = "ù") Or (c = "ø") Or (c = "û") Or (c = "õ") _
       Or (c = "ï") Or (c = "ê") Or (c = "è") Or (c = "é") _
       Or (c = "ú") Or (c = "ü") Or (c = "ë") Or (c = "â") _
       Or (c = "á") Or (c = "à") Or (c = "å") Or (c = "ã") _
       Or (c = "ä")) Then
         If i = 2 Then
            c = UCase(c)
         Else
            If Mid(vnstr, i - 2, 1) = " " Then
               c = UCase(c)
            End If
         End If
      End If
   ProperVni = ProperVni & c
   Next i
   If Len(vnstr) = 0 Then ProperVni = ""
End Function
 

Thông tin chi tiết
Tên file:
Một số đoạn code VBA trong Excel (chuyểddoooir Font chữ)
Phiên bản:
N/A
Tác giả:
N/A
Website hỗ trợ:
N/A
Thuộc chủ đề:
Kho dữ liệu » Kỹ năng CNTT
Gửi lên:
04/02/2015 15:21
Cập nhật:
04/02/2015 15:21
Người gửi:
admin
Thông tin bản quyền:
N/A
Dung lượng:
33.55 KB
Đã xem:
617
Đã tải về:
5
Đã thảo luận:
0
Tải về
Đánh giá
Bạn đánh giá thế nào về file này?
Hãy click vào hình sao để đánh giá File