Computer Learning Zone CLZ Access Excel Word Windows

Education is the best friend. An educated person is respected everywhere. Education beats the beauty and the youth.

-Chanakya
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Fancy Text    Comments List
Pinned    Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Fancy Text Full Text
Richard Rost 
          
3 years ago
0:00:00
Welcome to another Fast Tips video brought to you by ASPLearningZone.com. I am your instructor Richard Ross. In today's video, I'm going to show you how I create a function that I call FancyText, which takes a string and makes one character in that string black. Why? Purely aesthetic reasons. I was just having fun on my website, but it's a cool function. function. And then I'm going to show you how I used both Bard from Google and ChatGPT to create a function that instead of making that character black would just slightly darken the color. Again why? I don't know just messing around but it's really cool. And you'll see which one is the winner of today's coding challenge. Now even if you don't program an ASP or have an ASP website Now even if you don't program an ASP or have an ASP website, this is still a cool visual basic lesson.

0:00:53
So, I thought about making it a VB thing, but that's ASP because I did it on my website, so you get the point. Okay, if you've been to my website in the last year or so, you may have noticed if you go to a page that, and some people have caught me on this without me ever saying anything, that one letter is usually darker color. It's usually black. saying anything that one letter is usually darker color is usually black if you go to any you know anyone my articles on my site or any course page there you go with that. That's just me trying to be artistic. I'm just being stupid whatever but i just thought it would be nice. Actually I thought it would be cool to do something like that but that's a little too obtrusive okay that's a little too in your face that's too artsy fartsy for me face. That's too artsy-fartsy for me. But I always thought that it just kind of looked neat. But Alex is releasing a new course on Rubber Duck, which is a VBA program, and his is yellow. And the yellow with the black there just looks, that's just too much contrast.

0:01:56
So I thought, well, how about I take my fancy text code and write it so that instead of and write it so that instead of going black it just makes it subtly a little darker. Here's the final product. Here's what I got there. That's a little bit lighter shade of red for access and green. It looks much better with the yellow. Now I've had the classic fancy text in the Code Vault for a while. I think I briefly mentioned it in a video a while back, about six months ago. Originally it did that. There's the code.

0:02:24
while back, about six months ago. Originally it did that. There's the code. Gold members, you can find it in the code vault if you search for fancy, like I did, just search for fancy. Fancy, right? All right, this one swapped the foreground and background colors. All right, basically it just generates a random number and then it just, a random number from one to the size of the string, and then it just replaces that particular one.

0:02:51
It could be a different character each time. That's the whole point of it. size of the string and then it just replaces that particular one. It could be a different character each time. That's the whole point of it. Then I thought that was too dramatic, right? So then I swapped it to black. Okay. So now I'm thinking to myself, self, to make it so that this guy is just slightly darker in color than the surrounding color, you have to break the value up into its constituents parts because the first two characters represent red, then the next two are green, then the next two are blue.

0:03:12
parts because the first two characters represent red, then the next two are green, then the next two are blue, then you got to convert that to an integer or long, then you got to drop that value down a bit, then convert it back to hex. I know how to do all of that, but I didn't feel like looking up the code. So what I decided to do was challenge my good friends, the AI bots, both Bard and ChatGPT I tried.

0:03:37
I started with Bard. All right, so I said to Bard, I tried, and I started with BARD. All right, so I said to BARD, I said, I need a function in VBScript, which is what classic ASP is written in for classic ASP. Take a hex color and make it a slightly darker color. OK? And I said, sure. Here's a function for VBScript, classic ASP, blah, blah, blah, blah, blah, right?

0:03:53
And there's the code. It looks pretty good at first sight. All right, but then I realized that there's a couple of issues with it. First, classic ASP doesn't support byref and byval. a couple of issues with it. First, ClassicASP doesn't support byref and byval. Those are visual basic commands. So I said, ClassicASP doesn't support byval. So you're correct, ClassicASP does not support byval, but it'll still work if you remove byval.

0:04:15
Okay, not a problem. So then I remove that, and then I realized that it also doesn't support data typing in the parameters, or in a DIN statement, which I know. So everything is a variant, but you can't tell it that either. So everything is a variant, but you can't tell it that either. So then I said, nope, because it tries to tell me to declare it as a variant. I said, nope, Classic ASP doesn't support declaring a variable as a type.

0:04:36
You can't declare something as long or as string or whatever in Classic ASP VB script. You just leave this off, you declare your variables, and they're all variants by default. variants by default. So Bard apologized. I apologize to previous versions. You're correct. Classic ASP does not support declaring variables as types. All right, fine. So I removed all that. Then I discovered another problem. If you look at the code, it's looking for hex color dot substring. All right, that's a JavaScript function. That's how you do it in JavaScript. In VB or in ASP, you have to use the mid function, left, right, and mid functions, which I then told to Bard. function, left, right, and mid functions, which I then told to Bard.

0:05:16
I said, classic ASP doesn't support substring. And at that point, Bard gave up on me and says, look, it looks like you might want my help with coding, but I'm not trained to do that yet. I can do things like summarize long text, write an email, or even make a poem. Is there something else you'd like to try? So Bard gave up after like four attempts of me saying, no, that's not quite right. But it's getting there.

0:05:38
It's getting there. I can tell it's getting there. not quite right. But it's getting there. I can tell it's getting there. I love me some Google but you got a little bit of work to do on BARD. So then I went over to my good buddy ChatGPT. Same thing, need a function, it knocked it out of the park the first time. This code works perfectly. It even gave me what to do. It darkened it by 20%, drops it down by.8. I'm going to walk you through the code in just a minute to explain what's it down by 0.8. I'm going to walk you through the code in just a minute to explain what's going on here. All right. Then I fed it what I have and I said this line is giving me an error. I didn't tell it what the error was. I just wanted to see if it could figure it out. And it said if you're getting an error on that line, it's likely because hex color parameter is not a valid hex color value. And you know what? It's not because in my code I was sending it the hex value with the pound symbol in front of it. So all I had the hex value with the pound symbol in front of it.

0:06:27
So all I had to do was remove that and it worked. But what I did was, because I know I got code all over my website that calls fancy text, I just added this line to the darken hex color function that it wrote for me. And this just says, if I do send you a hex color where the left character is that, then just remove it by saying hex color equals right hex color comma 6. Grab those six right characters. And so that's it. right hex color comma 6.

0:06:49
Grab those six right characters. And so that's it. This was basically written just by chat GPT. It says you're going to convert the hex color to RGB values. We've got R, G, and B. It's going to be the long of, take mid hex color 1, 2, so that's the left two characters, the middle two characters, the right two characters, put an at H in front of them so you get hex values, and then convert that to a long integer. Now we've got a number representing each one of those.

0:07:12
and then convert that to a long integer. Now we got a number representing each one of those. Then take that number and multiply it by.8. When you bring the values down closer to zero, they get darker. And when you bring them up closer to F, it's zero through nine, then A, B, C, D, E, F, it's hex. If you bring those values down by.8, then it'll make it darker, each one of those. And zero is the darkest, so if you send it black, It will make it darker, right?

0:07:38
Each one of those and zero is the darkest. So if you send it black, you're just going to get black back. You can't get darker than black. Okay? Then we take these values and convert them back into a string, right? The right two, right? The right two of that, the right two of that. And that's how you basically make a darker version of the color that you send into it. And of course, then there's fancy text which basically says, give me L, R, and F. L is And of course, then there's fancy text, which basically says, give me L, R, and F.

0:08:05
L is the length of the string. And this line says, well, R is gonna be a random number, right? Started at one, okay? And it's gonna say, well, R is one, or R is L. And what that means is I don't wanna change the first character or the last character of the string. Why? I don't know, just aesthetic reasons. I guess we could get rid of the R equals one, but then this won't run.

0:08:26
So you could set R equals L at the beginning if you want. r equals one, but then this won't run. So you could set r equals l at the beginning if you want. If you want that first character to change. I always wanted it to be one of the characters in the middle. Or if mid s r one equals a space, obviously you don't change the foreground color of a space character. That would just be meaningless, right? So it's gonna loop until it finds an inner character basically, right?

0:08:45
R equals, this is a random number. All right, and then when you're done, build a string out of it, right? All right, and then when you're done, build a string out of it. The left of that string, the mid, is going to be that one character that you picked. And that's going to be color 2, which is your fancy darkened color, and then the end of the string here. And that's it. And then to use it in your code, you just do that. You send it a string, and then the color that you want is your base color.

0:09:11
And this guy will pick a random character in the middle of it, and then darken hex color will make it darker. This guy will pick a random character in the middle of it and then darken hex color will make it darker and that's that. But yeah, kudos to chatGPT for coming up with near perfect code. Well, no, it's code was perfect. It was me that sent it something wrong on the first shot. So there you go. Oh, and for my access nerds out there, this will work fine in access too if you want to do the same thing with a value from a text box that's using rich text.

0:09:37
You can do the same thing with hex codes. a text box that's using rich text, you can do the same thing with hex codes. If you guys really want to see it, let me know. I'll make a future tip video out of it. And the result with Alex's rubber duck looks like that. See, nice little subtle change. It's not quite the black, it's just a little darker. I think it looks really nice. Alex's rubber duck course isn't ready yet, but as soon as it is, I will make sure to post a note if you want to check it out.

0:10:01
So that's it. That's your fast tip for today. Hope you learned something. So that's it. That's your fast tip for today. Hope you learned something. Live long and prosper. And if you want to see more ASP videos, make sure you post a comment down below. Alright, thanks. We'll see you next time. Gold members, you will find the code for all of this in the code vault. I'll put a link down below on my website. Thanks for watching. To learn more ASP, visit my website at ASPlearningzone.com and watch my free 90-minute ASP 101 class. It will teach you everything you need to know to get your website up and running with ASP.

0:10:38
And after that, I've got lots more advanced topics including connecting your website to a database. And of course, I've got lots of additional lessons on all kinds of topics including my including my personal specialty, Microsoft Access, but also Word, Windows, Excel, and lots more. ComputerLearningZone.com. If you're watching this video on YouTube, make sure you subscribe to my channel, which is completely free. Click on the bell icon and select all to receive notifications when new videos are posted. If you enjoyed this video, please give me a thumbs up and post any comments you may have down below.

0:11:11
I try to read and answer all of them as soon as I can. and answer all of them as soon as I can. Thanks for watching. If you'd like to learn more ASP, visit my website at Thanks for watching. If you'd like to learn more ASP, visit my website at ASPLearningZone.com and watch my free 90-minute ASP 101 class. It will teach you everything you need to know to get your website up and running with ASP. And after that, I've got lots more advanced topics, including connecting your website to a database.

0:11:58
And of course, I've got lots of additional lessons on all kinds of topics, including my personal specialty, lessons on all kinds of topics including my personal specialty Microsoft Access, but also Word, Windows, Excel, and lots more. ComputerLearningZone.com. If you're watching this video on YouTube, make sure you subscribe to my channel, which is completely free. Click on the bell icon and select all to receive notifications when new videos are posted. If you enjoyed this video, please give me a thumbs up and post any comments you may have down below. I try to read and answer all of them as soon as I can. you may have down below. I try to read and answer all of them as soon as I can.

Adam Schwanz  @Reply  
           
3 years ago
More ASP videos :)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Fancy Text.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/17/2026 10:40:07 AM. PLT: 0s