Option Explicit
Public Function strRGBtoLong(sRGB As String) As Long
Dim aR%, aG%, aB%, Kat%, j%, j2%, j3%
On Error GoTo Err
'String-RGB nach Long konvertieren
Kat = 0
For j = 1 To Len(sRGB)
If Mid$(sRGB, j, 1) = "," And Kat = 1 Then
j3 = j
Exit For
ElseIf Mid$(sRGB, j, 1) = "," Then
j2 = j
Kat = Kat + 1
End If
Next
aR = CInt(Trim(Mid(sRGB, 5, j2 - 5)))
aG = CInt(Trim(Mid(sRGB, j2 + 1, (j3 - j2) - 1)))
aB = CInt(Trim(Mid(sRGB, j3 + 1, (Len(sRGB) - j3) - 1)))
strRGBtoLong = CLng(RGB(aR, aG, aB))
Err:
End Function
|