[AccessD] Is there a simpler way?

Stuart McLachlan stuart at lexacorp.com.pg
Tue Jul 12 18:15:17 CDT 2022


What? You mean you want HTML to be VBA compliant?

Here's a little function I've just written for you :)

Function HTMLColour(VBAColor As Long) As String
HTMLColour = "#" & Right$("000000" & Hex$(VBAColor), 6)
End Function




On 12 Jul 2022 at 18:45, John Colby wrote:

> I need a text enum (colors to be specific).  Enums are longs.  Sigh
> 
> Public Enum enumVBColors
>     Black = vbBlack
>     Red = vbRed
>     Green = vbGreen
>     Yellow = vbYellow
>     Blue = vbBlue
>     Magenta = vbMagenta
>     Cyan = vbCyan
>     White = vbWhite
> End Enum
> 
> Function fColor(intColor As enumVBColors) As String
>     Select Case intColor
>     Case enumVBColors.Black
>         fColor = "Black"
>     Case enumVBColors.Blue
>         fColor = "Blue"
>     Case enumVBColors.Cyan
>         fColor = "Cyan"
>     Case enumVBColors.Green
>         fColor = "Green"
>     Case enumVBColors.Magenta
>         fColor = "Magenta"
>     Case enumVBColors.Red
>         fColor = "Red"
>     Case enumVBColors.White
>         fColor = "White"
>     Case enumVBColors.Yellow
>         fColor = "Yellow"
>     End Select
> End Function
> 
> Does the trick but DAMN!  I can use these text strings as colors in
> the HTML tags.  But DAMN!  I hate ugly and this is just ugly.
> 
> Let the slappin' commence.
> 
> -- 
> John W. Colby
> Colby Consulting
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list