January 27, 2001

ColorToHTML – Convert a VB color for use in a HTML page

‘ convert a VB color code to the ##rrggbb format used in HTML attributesFunction ColorToHTML(ByVal color As Long) As String ‘ HTML color codes are in the format #RRGGBB (red, green, blue) ‘ while Hex(color) returns numbers in the format BBGGRR ‘ therefore we just have to invert the order

HTMLEncode – Encode a string so that it can be displayed in a browser

‘ Encode an string so that it can be displayed correctly’ inside the browser.” Same effect as the Server.HTMLEncode method in ASPFunction HTMLEncode(ByVal Text As String) As String Dim i As Integer Dim acode As Integer Dim repl As String HTMLEncode = Text For i = Len(HTMLEncode) To 1 Step

URLPathEncode – Convert a string for using on a URL path

‘ convert a string so that it can be used on a URL path” Same effect as the Server.URLPathEncode method in ASPFunction URLPathEncode(ByVal Text As String) As String Dim i As Integer Dim acode As Integer URLPathEncode = Text For i = Len(URLPathEncode) To 1 Step -1 acode = Asc(Mid$(URLPathEncode,

RecordsetToHTMLTable – Convert an ADO Recordset to a HTML table

‘ Create a HTML table from a recordset” set the TableAttribs argument to a suitable value’ (eg “BORDER=1”) to modify the table’s standard layout’ you should omit the NullValues argument if you want that null’ values are displayed in empty cells’ set the ShowFieldNames to True to display field names

URLEncode – Convert a string for using on a URL query string

‘ convert a string so that it can be used on a URL query string” Same effect as the Server.URLEncode method in ASPFunction URLEncode(ByVal Text As String) As String Dim i As Integer Dim acode As Integer Dim char As String URLEncode = Text For i = Len(URLEncode) To 1

HTMLDecode – Convert an HTML string to a plain text

‘ Decode an HTML string to a regular ANSI string” it strips down all special HTML sequences (eg “<“)’ however, it doesn’t strip HTML tagsFunction HTMLDecode(ByVal html As String) As String Dim i As Long HTMLDecode = html Do ‘ search the next ampersand, exit if no more i =