function CmpColor(color1,color2,x)' color1颜色1,color2颜色2,x色差0-255之间 数字越大颜色范围越大
dim r1,g1,b1,r2,g2,b2
r1 = color1 and 255'颜色1红
g1 = (color1 \ 256) and 255 '颜色1绿
b1 = color1 \ 65536 '颜色1蓝
r2 = color2 and 255 '颜色2红
g2 = (color2 \ 256) and 255 '颜色2绿
b2 = color2 \ 65536 '颜色2蓝
CmpColor = false
if abs(r1-r2) < x and abs(g1-g2) < x and abs(b1-b2) < x then
CmpColor = true
end if
end function
msgbox cmpcolor(&H102030,&H152535,5)