'*********************************************** ' class_Color '*********************************************** Private Type this Color As Variant Blue As Variant Red As Long Green As Long End Type Dim this As this '============================================== ' Esri (property) '============================================== Public Property Get Esri(ByVal Name As Variant) As IRGBColor Dim R As IRGBColor Me.Name = Name SplitColor Set R = New rgbColor R.Blue = this.Blue R.Red = this.Red R.Green = this.Green Set Esri = R End Property '================================================= ' Blue (Property) '================================================= Public Property Get Blue() As Variant SplitColor Blue = this.Blue End Property Public Property Let Blue(ByVal xBlue As Variant) this.Blue = xBlue Mod 255 MergeColor End Property '================================================= ' Green (Property) '================================================= Public Property Get Green() As Variant SplitColor Green = this.Green End Property Public Property Let Green(ByVal xGreen As Variant) this.Green = xGreen Mod 255 MergeColor End Property '================================================= ' Red (Property) '================================================= Public Property Get Red() As Variant SplitColor Red = this.Red End Property Public Property Let Red(ByVal xRed As Variant) this.Red = xRed Mod 255 MergeColor End Property '================================================ ' Value (property) '================================================ Public Property Get value() As Variant value = Me.Name End Property '================================================ ' Value (property) '================================================ Public Property Let value(ByVal iName As Variant) Dim Name, UName Name = LCase(iName) UName = UCase(iName) this.Color = UName If (Left(Name, 1) = "#") Then Exit Property this.Color = "#F0F8FF" If (Name = "aliceblue") Then Exit Property this.Color = "#FAEBD7" If (Name = "antiquewhite") Then Exit Property this.Color = "#00FFFF" If (Name = "aqua") Then Exit Property this.Color = "#7FFFD4" If (Name = "aquamarine") Then Exit Property this.Color = "#F0FFFF" If (Name = "azure") Then Exit Property this.Color = "#F5F5DC" If (Name = "beige") Then Exit Property this.Color = "#FFE4C4" If (Name = "bisque") Then Exit Property this.Color = "#000000" If (Name = "black") Then Exit Property this.Color = "#FFEBCD" If (Name = "blanchedalmond") Then Exit Property this.Color = "#0000FF" If (Name = "blue") Then Exit Property this.Color = "#8A2BE2" If (Name = "blueviolet") Then Exit Property this.Color = "#A52A2A" If (Name = "brown") Then Exit Property this.Color = "#DEB887" If (Name = "burlywood") Then Exit Property this.Color = "#5F9EA0" If (Name = "cadetblue") Then Exit Property this.Color = "#7FFF00" If (Name = "chartreuse") Then Exit Property this.Color = "#D2691E" If (Name = "chocolate") Then Exit Property this.Color = "#FF7F50" If (Name = "coral") Then Exit Property this.Color = "#6495ED" If (Name = "cornflowerblue") Then Exit Property this.Color = "#FFF8DC" If (Name = "cornsilk") Then Exit Property this.Color = "#DC143C" If (Name = "crimson") Then Exit Property this.Color = "#00FFFF" If (Name = "cyan") Then Exit Property this.Color = "#00008B" If (Name = "darkblue") Then Exit Property this.Color = "#008B8B" If (Name = "darkcyan") Then Exit Property this.Color = "#B8860B" If (Name = "darkgoldenrod") Then Exit Property this.Color = "#A9A9A9" If (Name = "darkgray") Then Exit Property this.Color = "#A9A9A9" If (Name = "darkgrey") Then Exit Property this.Color = "#006400" If (Name = "darkgreen") Then Exit Property this.Color = "#BDB76B" If (Name = "darkkhaki") Then Exit Property this.Color = "#8B008B" If (Name = "darkmagenta") Then Exit Property this.Color = "#556B2F" If (Name = "darkolivegreen") Then Exit Property this.Color = "#FF8C00" If (Name = "darkorange") Then Exit Property this.Color = "#9932CC" If (Name = "darkorchid") Then Exit Property this.Color = "#8B0000" If (Name = "darkred") Then Exit Property this.Color = "#E9967A" If (Name = "darksalmon") Then Exit Property this.Color = "#8FBC8F" If (Name = "darkseagreen") Then Exit Property this.Color = "#483D8B" If (Name = "darkslateblue") Then Exit Property this.Color = "#2F4F4F" If (Name = "darkslategray") Then Exit Property this.Color = "#2F4F4F" If (Name = "darkslategrey") Then Exit Property this.Color = "#00CED1" If (Name = "darkturquoise") Then Exit Property this.Color = "#9400D3" If (Name = "darkviolet") Then Exit Property this.Color = "#FF1493" If (Name = "deeppink") Then Exit Property this.Color = "#00BFFF" If (Name = "deepskyblue") Then Exit Property this.Color = "#696969" If (Name = "dimgray") Then Exit Property this.Color = "#696969" If (Name = "dimgrey") Then Exit Property this.Color = "#1E90FF" If (Name = "dodgerblue") Then Exit Property this.Color = "#B22222" If (Name = "firebrick") Then Exit Property this.Color = "#FFFAF0" If (Name = "floralwhite") Then Exit Property this.Color = "#228B22" If (Name = "forestgreen") Then Exit Property this.Color = "#FF00FF" If (Name = "fuchsia") Then Exit Property this.Color = "#DCDCDC" If (Name = "gainsboro") Then Exit Property this.Color = "#F8F8FF" If (Name = "ghostwhite") Then Exit Property this.Color = "#FFD700" If (Name = "gold") Then Exit Property this.Color = "#DAA520" If (Name = "goldenrod") Then Exit Property this.Color = "#808080" If (Name = "gray") Then Exit Property this.Color = "#808080" If (Name = "grey") Then Exit Property this.Color = "#008000" If (Name = "green") Then Exit Property this.Color = "#ADFF2F" If (Name = "greenyellow") Then Exit Property this.Color = "#F0FFF0" If (Name = "honeydew") Then Exit Property this.Color = "#FF69B4" If (Name = "hotpink") Then Exit Property this.Color = "#CD5C5C" If (Name = "indianred") Then Exit Property this.Color = "#4B0082" If (Name = "indigo") Then Exit Property this.Color = "#FFFFF0" If (Name = "ivory") Then Exit Property this.Color = "#F0E68C" If (Name = "khaki") Then Exit Property this.Color = "#E6E6FA" If (Name = "lavender") Then Exit Property this.Color = "#FFF0F5" If (Name = "lavenderblush") Then Exit Property this.Color = "#7CFC00" If (Name = "lawngreen") Then Exit Property this.Color = "#FFFACD" If (Name = "lemonchiffon") Then Exit Property this.Color = "#ADD8E6" If (Name = "lightblue") Then Exit Property this.Color = "#F08080" If (Name = "lightcoral") Then Exit Property this.Color = "#E0FFFF" If (Name = "lightcyan") Then Exit Property this.Color = "#FAFAD2" If (Name = "lightgoldenrodyellow") Then Exit Property this.Color = "#D3D3D3" If (Name = "lightgray") Then Exit Property this.Color = "#D3D3D3" If (Name = "lightgrey") Then Exit Property this.Color = "#90EE90" If (Name = "lightgreen") Then Exit Property this.Color = "#FFB6C1" If (Name = "lightpink") Then Exit Property this.Color = "#FFA07A" If (Name = "lightsalmon") Then Exit Property this.Color = "#20B2AA" If (Name = "lightseagreen") Then Exit Property this.Color = "#87CEFA" If (Name = "lightskyblue") Then Exit Property this.Color = "#778899" If (Name = "lightslategray") Then Exit Property this.Color = "#778899" If (Name = "lightslategrey") Then Exit Property this.Color = "#B0C4DE" If (Name = "lightsteelblue") Then Exit Property this.Color = "#FFFFE0" If (Name = "lightyellow") Then Exit Property this.Color = "#00FF00" If (Name = "lime") Then Exit Property this.Color = "#32CD32" If (Name = "limegreen") Then Exit Property this.Color = "#FAF0E6" If (Name = "linen") Then Exit Property this.Color = "#FF00FF" If (Name = "magenta") Then Exit Property this.Color = "#800000" If (Name = "maroon") Then Exit Property this.Color = "#66CDAA" If (Name = "mediumaquamarine") Then Exit Property this.Color = "#0000CD" If (Name = "mediumblue") Then Exit Property this.Color = "#BA55D3" If (Name = "mediumorchid") Then Exit Property this.Color = "#9370D8" If (Name = "mediumpurple") Then Exit Property this.Color = "#3CB371" If (Name = "mediumseagreen") Then Exit Property this.Color = "#7B68EE" If (Name = "mediumslateblue") Then Exit Property this.Color = "#00FA9A" If (Name = "mediumspringgreen") Then Exit Property this.Color = "#48D1CC" If (Name = "mediumturquoise") Then Exit Property this.Color = "#C71585" If (Name = "mediumvioletred") Then Exit Property this.Color = "#191970" If (Name = "midnightblue") Then Exit Property this.Color = "#F5FFFA" If (Name = "mintcream") Then Exit Property this.Color = "#FFE4E1" If (Name = "mistyrose") Then Exit Property this.Color = "#FFE4B5" If (Name = "moccasin") Then Exit Property this.Color = "#FFDEAD" If (Name = "navajowhite") Then Exit Property this.Color = "#000080" If (Name = "navy") Then Exit Property this.Color = "#FDF5E6" If (Name = "oldlace") Then Exit Property this.Color = "#808000" If (Name = "olive") Then Exit Property this.Color = "#6B8E23" If (Name = "olivedrab") Then Exit Property this.Color = "#FFA500" If (Name = "orange") Then Exit Property this.Color = "#FF4500" If (Name = "orangered") Then Exit Property this.Color = "#DA70D6" If (Name = "orchid") Then Exit Property this.Color = "#EEE8AA" If (Name = "palegoldenrod") Then Exit Property this.Color = "#98FB98" If (Name = "palegreen") Then Exit Property this.Color = "#AFEEEE" If (Name = "paleturquoise") Then Exit Property this.Color = "#D87093" If (Name = "palevioletred") Then Exit Property this.Color = "#FFEFD5" If (Name = "papayawhip") Then Exit Property this.Color = "#FFDAB9" If (Name = "peachpuff") Then Exit Property this.Color = "#CD853F" If (Name = "peru") Then Exit Property this.Color = "#FFC0CB" If (Name = "pink") Then Exit Property this.Color = "#DDA0DD" If (Name = "plum") Then Exit Property this.Color = "#B0E0E6" If (Name = "powderblue") Then Exit Property this.Color = "#800080" If (Name = "purple") Then Exit Property this.Color = "#FF0000" If (Name = "red") Then Exit Property this.Color = "#BC8F8F" If (Name = "rosybrown") Then Exit Property this.Color = "#4169E1" If (Name = "royalblue") Then Exit Property this.Color = "#8B4513" If (Name = "saddlebrown") Then Exit Property this.Color = "#FA8072" If (Name = "salmon") Then Exit Property this.Color = "#F4A460" If (Name = "sandybrown") Then Exit Property this.Color = "#2E8B57" If (Name = "seagreen") Then Exit Property this.Color = "#FFF5EE" If (Name = "seashell") Then Exit Property this.Color = "#A0522D" If (Name = "sienna") Then Exit Property this.Color = "#C0C0C0" If (Name = "silver") Then Exit Property this.Color = "#87CEEB" If (Name = "skyblue") Then Exit Property this.Color = "#6A5ACD" If (Name = "slateblue") Then Exit Property this.Color = "#708090" If (Name = "slategray") Then Exit Property this.Color = "#708090" If (Name = "slategrey") Then Exit Property this.Color = "#FFFAFA" If (Name = "snow") Then Exit Property this.Color = "#00FF7F" If (Name = "springgreen") Then Exit Property this.Color = "#4682B4" If (Name = "steelblue") Then Exit Property this.Color = "#D2B48C" If (Name = "tan") Then Exit Property this.Color = "#008080" If (Name = "teal") Then Exit Property this.Color = "#D8BFD8" If (Name = "thistle") Then Exit Property this.Color = "#FF6347" If (Name = "tomato") Then Exit Property this.Color = "#40E0D0" If (Name = "turquoise") Then Exit Property this.Color = "#EE82EE" If (Name = "violet") Then Exit Property this.Color = "#F5DEB3" If (Name = "wheat") Then Exit Property this.Color = "#FFFFFF" If (Name = "white") Then Exit Property this.Color = "#F5F5F5" If (Name = "whitesmoke") Then Exit Property this.Color = "#FFFF00" If (Name = "yellow") Then Exit Property this.Color = "#9ACD32" If (Name = "yellowgreen") Then Exit Property this.Color = "#000000" End Property '========================================================================= ' Name Property '========================================================================= Public Property Get Name() As Variant Name = "AliceBlue" If (this.Color = "#F0F8FF") Then Exit Property Name = "AntiqueWhite" If (this.Color = "#FAEBD7") Then Exit Property Name = "Aqua" If (this.Color = "#00FFFF") Then Exit Property Name = "Aquamarine" If (this.Color = "#7FFFD4") Then Exit Property Name = "Azure" If (this.Color = "#F0FFFF") Then Exit Property Name = "Beige" If (this.Color = "#F5F5DC") Then Exit Property Name = "Bisque" If (this.Color = "#FFE4C4") Then Exit Property Name = "Black" If (this.Color = "#000000") Then Exit Property Name = "BlanchedAlmond" If (this.Color = "#FFEBCD") Then Exit Property Name = "Blue" If (this.Color = "#0000FF") Then Exit Property Name = "BlueViolet" If (this.Color = "#8A2BE2") Then Exit Property Name = "Brown" If (this.Color = "#A52A2A") Then Exit Property Name = "BurlyWood" If (this.Color = "#DEB887") Then Exit Property Name = "CadetBlue" If (this.Color = "#5F9EA0") Then Exit Property Name = "Chartreuse" If (this.Color = "#7FFF00") Then Exit Property Name = "Chocolate" If (this.Color = "#D2691E") Then Exit Property Name = "Coral" If (this.Color = "#FF7F50") Then Exit Property Name = "CornflowerBlue" If (this.Color = "#6495ED") Then Exit Property Name = "Cornsilk" If (this.Color = "#FFF8DC") Then Exit Property Name = "Crimson" If (this.Color = "#DC143C") Then Exit Property Name = "Cyan" If (this.Color = "#00FFFF") Then Exit Property Name = "DarkBlue" If (this.Color = "#00008B") Then Exit Property Name = "DarkCyan" If (this.Color = "#008B8B") Then Exit Property Name = "DarkGoldenRod" If (this.Color = "#B8860B") Then Exit Property Name = "DarkGray" If (this.Color = "#A9A9A9") Then Exit Property Name = "DarkGrey" If (this.Color = "#A9A9A9") Then Exit Property Name = "DarkGreen" If (this.Color = "#006400") Then Exit Property Name = "DarkKhaki" If (this.Color = "#BDB76B") Then Exit Property Name = "DarkMagenta" If (this.Color = "#8B008B") Then Exit Property Name = "DarkOliveGreen" If (this.Color = "#556B2F") Then Exit Property Name = "Darkorange" If (this.Color = "#FF8C00") Then Exit Property Name = "DarkOrchid" If (this.Color = "#9932CC") Then Exit Property Name = "DarkRed" If (this.Color = "#8B0000") Then Exit Property Name = "DarkSalmon" If (this.Color = "#E9967A") Then Exit Property Name = "DarkSeaGreen" If (this.Color = "#8FBC8F") Then Exit Property Name = "DarkSlateBlue" If (this.Color = "#483D8B") Then Exit Property Name = "DarkSlateGray" If (this.Color = "#2F4F4F") Then Exit Property Name = "DarkSlateGrey" If (this.Color = "#2F4F4F") Then Exit Property Name = "DarkTurquoise" If (this.Color = "#00CED1") Then Exit Property Name = "DarkViolet" If (this.Color = "#9400D3") Then Exit Property Name = "DeepPink" If (this.Color = "#FF1493") Then Exit Property Name = "DeepSkyBlue" If (this.Color = "#00BFFF") Then Exit Property Name = "DimGray" If (this.Color = "#696969") Then Exit Property Name = "DimGrey" If (this.Color = "#696969") Then Exit Property Name = "DodgerBlue" If (this.Color = "#1E90FF") Then Exit Property Name = "FireBrick" If (this.Color = "#B22222") Then Exit Property Name = "FloralWhite" If (this.Color = "#FFFAF0") Then Exit Property Name = "ForestGreen" If (this.Color = "#228B22") Then Exit Property Name = "Fuchsia" If (this.Color = "#FF00FF") Then Exit Property Name = "Gainsboro" If (this.Color = "#DCDCDC") Then Exit Property Name = "GhostWhite" If (this.Color = "#F8F8FF") Then Exit Property Name = "Gold" If (this.Color = "#FFD700") Then Exit Property Name = "GoldenRod" If (this.Color = "#DAA520") Then Exit Property Name = "Gray" If (this.Color = "#808080") Then Exit Property Name = "Grey" If (this.Color = "#808080") Then Exit Property Name = "Green" If (this.Color = "#008000") Then Exit Property Name = "GreenYellow" If (this.Color = "#ADFF2F") Then Exit Property Name = "HoneyDew" If (this.Color = "#F0FFF0") Then Exit Property Name = "HotPink" If (this.Color = "#FF69B4") Then Exit Property Name = "IndianRed" If (this.Color = "#CD5C5C") Then Exit Property Name = "Indigo" If (this.Color = "#4B0082") Then Exit Property Name = "Ivory" If (this.Color = "#FFFFF0") Then Exit Property Name = "Khaki" If (this.Color = "#F0E68C") Then Exit Property Name = "Lavender" If (this.Color = "#E6E6FA") Then Exit Property Name = "LavenderBlush" If (this.Color = "#FFF0F5") Then Exit Property Name = "LawnGreen" If (this.Color = "#7CFC00") Then Exit Property Name = "LemonChiffon" If (this.Color = "#FFFACD") Then Exit Property Name = "LightBlue" If (this.Color = "#ADD8E6") Then Exit Property Name = "LightCoral" If (this.Color = "#F08080") Then Exit Property Name = "LightCyan" If (this.Color = "#E0FFFF") Then Exit Property Name = "LightGoldenRodYellow" If (this.Color = "#FAFAD2") Then Exit Property Name = "LightGray" If (this.Color = "#D3D3D3") Then Exit Property Name = "LightGrey" If (this.Color = "#D3D3D3") Then Exit Property Name = "LightGreen" If (this.Color = "#90EE90") Then Exit Property Name = "LightPink" If (this.Color = "#FFB6C1") Then Exit Property Name = "LightSalmon" If (this.Color = "#FFA07A") Then Exit Property Name = "LightSeaGreen" If (this.Color = "#20B2AA") Then Exit Property Name = "LightSkyBlue" If (this.Color = "#87CEFA") Then Exit Property Name = "LightSlateGray" If (this.Color = "#778899") Then Exit Property Name = "LightSlateGrey" If (this.Color = "#778899") Then Exit Property Name = "LightSteelBlue" If (this.Color = "#B0C4DE") Then Exit Property Name = "LightYellow" If (this.Color = "#FFFFE0") Then Exit Property Name = "Lime" If (this.Color = "#00FF00") Then Exit Property Name = "LimeGreen" If (this.Color = "#32CD32") Then Exit Property Name = "Linen" If (this.Color = "#FAF0E6") Then Exit Property Name = "Magenta" If (this.Color = "#FF00FF") Then Exit Property Name = "Maroon" If (this.Color = "#800000") Then Exit Property Name = "MediumAquaMarine" If (this.Color = "#66CDAA") Then Exit Property Name = "MediumBlue" If (this.Color = "#0000CD") Then Exit Property Name = "MediumOrchid" If (this.Color = "#BA55D3") Then Exit Property Name = "MediumPurple" If (this.Color = "#9370D8") Then Exit Property Name = "MediumSeaGreen" If (this.Color = "#3CB371") Then Exit Property Name = "MediumSlateBlue" If (this.Color = "#7B68EE") Then Exit Property Name = "MediumSpringGreen" If (this.Color = "#00FA9A") Then Exit Property Name = "MediumTurquoise" If (this.Color = "#48D1CC") Then Exit Property Name = "MediumVioletRed" If (this.Color = "#C71585") Then Exit Property Name = "MidnightBlue" If (this.Color = "#191970") Then Exit Property Name = "MintCream" If (this.Color = "#F5FFFA") Then Exit Property Name = "MistyRose" If (this.Color = "#FFE4E1") Then Exit Property Name = "Moccasin" If (this.Color = "#FFE4B5") Then Exit Property Name = "NavajoWhite" If (this.Color = "#FFDEAD") Then Exit Property Name = "Navy" If (this.Color = "#000080") Then Exit Property Name = "OldLace" If (this.Color = "#FDF5E6") Then Exit Property Name = "Olive" If (this.Color = "#808000") Then Exit Property Name = "OliveDrab" If (this.Color = "#6B8E23") Then Exit Property Name = "Orange" If (this.Color = "#FFA500") Then Exit Property Name = "OrangeRed" If (this.Color = "#FF4500") Then Exit Property Name = "Orchid" If (this.Color = "#DA70D6") Then Exit Property Name = "PaleGoldenRod" If (this.Color = "#EEE8AA") Then Exit Property Name = "PaleGreen" If (this.Color = "#98FB98") Then Exit Property Name = "PaleTurquoise" If (this.Color = "#AFEEEE") Then Exit Property Name = "PaleVioletRed" If (this.Color = "#D87093") Then Exit Property Name = "PapayaWhip" If (this.Color = "#FFEFD5") Then Exit Property Name = "PeachPuff" If (this.Color = "#FFDAB9") Then Exit Property Name = "Peru" If (this.Color = "#CD853F") Then Exit Property Name = "Pink" If (this.Color = "#FFC0CB") Then Exit Property Name = "Plum" If (this.Color = "#DDA0DD") Then Exit Property Name = "PowderBlue" If (this.Color = "#B0E0E6") Then Exit Property Name = "Purple" If (this.Color = "#800080") Then Exit Property Name = "Red" If (this.Color = "#FF0000") Then Exit Property Name = "RosyBrown" If (this.Color = "#BC8F8F") Then Exit Property Name = "RoyalBlue" If (this.Color = "#4169E1") Then Exit Property Name = "SaddleBrown" If (this.Color = "#8B4513") Then Exit Property Name = "Salmon" If (this.Color = "#FA8072") Then Exit Property Name = "SandyBrown" If (this.Color = "#F4A460") Then Exit Property Name = "SeaGreen" If (this.Color = "#2E8B57") Then Exit Property Name = "SeaShell" If (this.Color = "#FFF5EE") Then Exit Property Name = "Sienna" If (this.Color = "#A0522D") Then Exit Property Name = "Silver" If (this.Color = "#C0C0C0") Then Exit Property Name = "SkyBlue" If (this.Color = "#87CEEB") Then Exit Property Name = "SlateBlue" If (this.Color = "#6A5ACD") Then Exit Property Name = "SlateGray" If (this.Color = "#708090") Then Exit Property Name = "SlateGrey" If (this.Color = "#708090") Then Exit Property Name = "Snow" If (this.Color = "#FFFAFA") Then Exit Property Name = "SpringGreen" If (this.Color = "#00FF7F") Then Exit Property Name = "SteelBlue" If (this.Color = "#4682B4") Then Exit Property Name = "Tan" If (this.Color = "#D2B48C") Then Exit Property Name = "Teal" If (this.Color = "#008080") Then Exit Property Name = "Thistle" If (this.Color = "#D8BFD8") Then Exit Property Name = "Tomato" If (this.Color = "#FF6347") Then Exit Property Name = "Turquoise" If (this.Color = "#40E0D0") Then Exit Property Name = "Violet" If (this.Color = "#EE82EE") Then Exit Property Name = "Wheat" If (this.Color = "#F5DEB3") Then Exit Property Name = "White" If (this.Color = "#FFFFFF") Then Exit Property Name = "WhiteSmoke" If (this.Color = "#F5F5F5") Then Exit Property Name = "Yellow" If (this.Color = "#FFFF00") Then Exit Property Name = "YellowGreen" If (this.Color = "#9ACD32") Then Exit Property Name = this.Color End Property '================================================================== ' Name (Property) '================================================================== Public Property Let Name(ByVal xName As Variant) Me.value = xName End Property '================================================================== ' SplitColor '================================================================== Private Sub SplitColor() Dim R, g, b this.Red = fromHex(Mid(this.Color, 2, 2)) this.Green = fromHex(Mid(this.Color, 4, 2)) this.Blue = fromHex(Mid(this.Color, 6, 2)) End Sub '================================================================== ' MergeColor '================================================================== Private Sub MergeColor() Dim R, g, b this.Color = "#" & toHex(this.Red) & toHex(this.Green) & toHex(this.Blue) End Sub '================================================================== ' fromHex '================================================================== Private Function fromHex(itext) As Long Dim a, b As Long Dim text As String text = UCase(Trim(itext)) a = hexValue(Mid(text, 1, 1)) b = hexValue(Mid(text, 2, 1)) fromHex = (a * 16) + b End Function '================================================================== ' HexValue '================================================================== Private Function hexValue(text) As Long Dim n As Long hexValue = 0 If (text = "0") Then hexValue = 0 If (text = "1") Then hexValue = 1 If (text = "2") Then hexValue = 2 If (text = "3") Then hexValue = 3 If (text = "4") Then hexValue = 4 If (text = "5") Then hexValue = 5 If (text = "6") Then hexValue = 6 If (text = "7") Then hexValue = 7 If (text = "8") Then hexValue = 8 If (text = "9") Then hexValue = 9 If (text = "A") Then hexValue = 10 If (text = "B") Then hexValue = 11 If (text = "C") Then hexValue = 12 If (text = "D") Then hexValue = 13 If (text = "E") Then hexValue = 14 If (text = "F") Then hexValue = 15 End Function '================================================================== ' toHex '================================================================== Private Function toHex(num) As String Dim a, b As Long Dim n1, n2 As String a = (num / 16) b = num Mod 16 If (a = 0) Then n1 = "0" If (a = 1) Then n1 = "1" If (a = 2) Then n1 = "2" If (a = 3) Then n1 = "3" If (a = 4) Then n1 = "4" If (a = 5) Then n1 = "5" If (a = 6) Then n1 = "6" If (a = 7) Then n1 = "7" If (a = 8) Then n1 = "8" If (a = 9) Then n1 = "9" If (a = 10) Then n1 = "A" If (a = 11) Then n1 = "B" If (a = 12) Then n1 = "C" If (a = 13) Then n1 = "D" If (a = 14) Then n1 = "E" If (a = 15) Then n1 = "F" If (b = 0) Then n2 = "0" If (b = 1) Then n2 = "1" If (b = 2) Then n2 = "2" If (b = 3) Then n2 = "3" If (b = 4) Then n2 = "4" If (b = 5) Then n2 = "5" If (b = 6) Then n2 = "6" If (b = 7) Then n2 = "7" If (b = 8) Then n2 = "8" If (b = 9) Then n2 = "9" If (b = 10) Then n2 = "A" If (b = 11) Then n2 = "B" If (b = 12) Then n2 = "C" If (b = 13) Then n2 = "D" If (b = 14) Then n2 = "E" If (b = 15) Then n2 = "F" toHex = a & b End Function