I started writing a function not to long ago to do this. Unfortunatly as I did not have time to finish it to my satisfaction it hasn't been posted anywhere. Depending on how complicated you want to get, this can be a quick job or a slightly less than quick job.
Basically the above statement will get you on your way, but it will need to be extended a little.
I assume for the following that you have the html stored in a single string (like from a db) and that you will have mixed html and ASP code
1. Define a a startPosition and endPosition variable
2. startPosition = InStr(yourPage,"<"

3. while startPosition > 0
4. endPosition = InStr(startPosition,">"
5. if the character at start position + 1 is a % (<%) or a ! (<!--) move on
6. else replace by grabbing left to startPosition & font tag & mid from startPosition to endPosition - startPosition & end font tag & right from end position to len() - endPosition
7. Reset your counter for the next loop
8. Repeat loop logic for HTML comments
9. Loop for ASP comments (use REM instead of ')
your end position will be the next vbCRLF that you find (end of line)
10. Now replace all vbCrLf's with <br> tags so it will display correctly on the web page.
After doing the above you can get more complicated if you like and start coloring certain portion of the ASP. You will want to split this off into another function because you wouldn't want to accidentally color something in the HTML as ASP.
For each string you find that starts with <% and ends with %> send it to the function:
For each line with quotes on it, get a pair of start and end quotes, if the endquotes + 1 is also a quote (""

get the next one after the pair (Instr(endquotes+2,""""

). Add pink to both ends, shove it back in the string, continue to next.
Now create an array of words that you want to be red in the ASP. For each word in the array do a replace that will replace all occurences of it with font color=red and the tag name and /font.
Now you have one long string of ASP code that is color coded, before you return it, concatenate on the front and the end of the the string another font tags to make all non-colored text appear a certain base color (I prefer brown for my ASP). Return it
Your main function just finished getting back the last ASP string in it's loop. All done.
Hope that helps you plan out the code a little better. I am sure there are other ways to do this, this was just mine
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...)
