How do I convert the # tha the common dialog gives for color into a Hex number for a web page?
(if that is hex)
<body bgcolor="#ffffff"
which is white
white = 16777215 in the common dialog....
:) Thanks!
Printable View
How do I convert the # tha the common dialog gives for color into a Hex number for a web page?
(if that is hex)
<body bgcolor="#ffffff"
which is white
white = 16777215 in the common dialog....
:) Thanks!
Testing...
Code:Dim tmp As String
Open "c:\wordlist.txt" For Binary As #1
tmp = Space(LOF(1))
Get #1, , tmp
Close #1
'this is a test....never mind I found the code
words = Split(tmp, vbCrLf)
End Sub
Never Mind that is not right?
Anyone know how to convert it?
I think I am seeing it as split into the rgb? am i right?
## ## ##
FF FF FF
255,255,255 ?
right?
How to do?
use the Hex$() function:
Code:Debug.Print Hex$(16777215)
Your problem is this: VB doesn't put the color values in the same order that the web does. Here is some code i have previously written for that very function:
[code]
dim red as byte
dim green as byte
dim blue as byte
dim webcolor as string
call splitvbcolor (object.color, blue, green, red)
webcolor = zeropad(rgb(red, green, blue))
Sub SplitVBColor(VBColor As Long, Blue As Byte, Green As Byte, Red As Byte)
Red = VBColor And &HFF
Green = (VBColor And &HFF00&) \ &H100&
Blue = (VBColor And &HFF0000) \ &H10000
End Sub
Function ZeroPad(HexNumber As String) As String
ZeroPad = Left$("000000", 6 - Len(HexNumber)) + HexNumber
End Function
If you're interested, i have attached a module i am working on currently with the above functions and a couple of other neat color-manipulating ones you might find interesting.
Code:lred = Lcolor Mod &H100
lgreen = Lcolor \ &H100 Mod &H100
lblue = Lcolor \ &H10000 Mod &H100
lred = Hex(lred)
If lred = "0" Then lred = "00"
lgreen = Hex(lgreen)
If lgreen = "0" Then lgreen = "00"
lblue = Hex(lblue)
If lblue = "0" Then lblue = "00"
Wcolor = lred & lgreen & lblue
Thank you...