Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > VBA Editor Themes < Lookup Wizard | VBA Editor Themes 2 >
Back to VBA Editor Themes    Comments List
Pinned    Upload Images   Link   Email  
Transcript
Richard Rost 
           
11 months ago
In today's video, I'm going to show you how to set up VBA editor themes so we can have different color themes in our VBA editor. You can save those themes in a table and use a form with a little bit of VBA to switch between them.

Okay, so last week I released a video called VBA Editor Colors where I show you how to go into the VBA editor and adjust the color settings. Me personally, when I'm working, I like a dark background. I think it's easier to see. I think this guy is a lot easier on the eyes to work with, especially me, I got very poor eyesight. Whereas, the default setting is like this.

Now the comments that I got were everything from, "Oh wow, that's super cool, I'm going to do that," to "Please don't do that, it's very difficult to see in your videos," which after some further thought I kind of agree. This is easier on the eyes as a programmer, but I think it is actually harder to read in my videos. This comes across in the videos a lot easier.

I'm thinking to myself, "Well, self, there's got to be a way to switch between these." Now, there's nothing in the VBA editor itself that allows you to easily and quickly switch between these things. And of course, a few people even mentioned it in comments on my forums and on my YouTube channel, they said, "Well, I think those settings are saved in the registry." Oh yeah, guess what? They are.

With a little bit of VBA code, we can read those settings out of the registry and then write them back, and we can create a table and a little form and save multiple profiles. Make the settings changes in Access, save those to our table, change them again to whatever else you want, save the table again, and now we can flip between them. Okay, basically it's setting up your own theme editor.

So if you haven't watched last week's video on the VBA editor colors, go watch it now. I basically just show you how to set up the different color changes and stuff in the VBA editor itself.

Now before we get started, I'm going to give everybody a warning. Back up your data and make sure you've got a full backup of your PC as well. Windows backup. A good image of your entire drive because, in order to do this, we need to read and write from the registry. If you don't know what the registry is, I'm going to explain it in just a minute, but this is part of Windows and if something goes wrong and you mess up the registry, you could make your system not bootable. I'm just giving everybody the warning before you do this. What I'm showing you should be perfectly safe, but as a disclaimer, you never know. So always make sure you've got a good backup of everything, your databases, all your data, and of course, Windows itself. If you don't have a backup, and if you don't remember when the last time you made a full backup was, now is the time to go do it. Okay? You'll thank me later.

All right, so if you don't know what the registry is, it's basically a database that is stored in Windows, and it keeps settings for Windows itself and most of the other applications that you have on your system. They're all stored in this big database called the registry.

How do you get to the registry? Well, you click on your start button in Windows. You type in regedit, R-E-G-E-D-I-T. That's short for registry editor. You'll get the Windows security pop-up that shows, you know, you're going to have to run this as an administrator. Are you sure? Say yes. I can't show it to you easily on the screen here because it bypasses my video recording software, but then you'll get this thing up. Alright, this is the registry editor, and it might show up like this up top here. Right, there are different groups, there's Classes Root, Current User, Local Machine, there's all kinds of different stuff.

I go over this in a lot more detail in my developer classes, but what you're looking for is under HKEY_CURRENT_USER, right, open them up with these little arrows over here, okay, then SOFTWARE, then MICROSOFT, then come on down to VBA, and then 7.1 or whatever version you have installed on your machine, and then COMMON. This is the registry key we're looking for right here, the folder that the keys are in. And over here are all the keys themselves.

Now I'm just showing this to you for demonstration purposes. We are not going to make the changes directly in the registry editor. This is just to show you where they are, what they look like. There are four that we care about. There's CodeBackColors, CodeForeColors, FontFace, and FontHeight. Those are the only four we're going to mess with. You can play with these other ones if you want to, but do so at your own risk. This is basically a list of the different colors that are specified in the VBA editor itself. When you drop those little color boxes down, all these numbers represent one of those. Same thing with the ForeColors.

We're not going to change them here. We're going to change them in Access and then just save that setting to our database. Same thing with the FontFace, that's pretty straightforward, right, and standard, and then FontHeight, which is a number, we'll get to that in just a few minutes. But again, just showing you where this is, don't mess with it in here, don't touch it inside the registry editor. In fact, you don't even have to open up the registry editor if you don't want to; don't even come in here.

Alright, so let's close that, let's go back to Access. Alright, so here I am in my TechHelp free template. This is a free database you can grab off my website if you want to, but we don't even really need this today. So we're just going to make a table and a form to save our VBA themes in, okay? So let's start with a table create table design. This will be our VBA Theme ID, our autonumber, we'll give it a description. Like light mode, dark mode, teaching mode, whatever you want, whatever mode you want.

Okay, now we need four fields to store the different registry key values. I'm going to use the same names as they are in the registry. So it's CodeBackColors, that's a string, CodeForeColors, we've got FontFace, and then we have FontHeight which is stored as a number, so we'll make that a number here. Okay, save this as my VBA ThemeT table, primary key sure. Okay, close that. Let's make a continuous form out of this. I'm going to take my continuous blank right here, copy, paste, we're going to call this the VBA ThemeF. Let's open her up in design mode, right-click, design mode.

Let's set the record source equal to the VBA ThemeT. Now we can add fields. I'm going to grab all the fields. That's click, shift-click on the last one. Let's drag them all over, just drop them down here in the form footer for now. Okay. Up top, I'm going to put the ID and the description, and then we'll put the values for the keys down in the footer. So we're going to do, I only keep these around here for the format painting. So I'm going to format paint over you, and then these are all fine. So I'm going to grab this and go like this, this, this, this.

Now I'm going to slide the ID over here and get rid of your label. And it doesn't need to be quite that big. And then the same thing with the description. The description there. Change the label up top. And then we've got these guys down underneath. And we'll make these a little bit bigger. Okey dokey. Okey-dokey, all right, so that color, FontSpace, and the FontHeight doesn't need to be that big. Okay, all right.

Alright, so now we're going to save this and let's see what we got real quick. Come back out here, close it, open it, all right, and now we can set up a dark mode and a light mode. What we're going to do is we're going to put two buttons on here: one to get the settings from the registry and save it, and then another one to put the settings that we have in here back to the registry. That's going to involve some VBA code to read and write keys from the registry, and we will talk about that tomorrow in part 2. So tune in tomorrow, same bat time, same bat channel.

Or if you remember, where is it, where's my slide, there it is. If you're a member, you can watch it right now because I'm about to record it in just a few minutes. So that's going to be your TechHelp video for today. I hope you learned something. Live long and prosper, my friends. I'll see you tomorrow in part 2.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in VBA Editor Themes.
 

 
 
 

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 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 1/14/2025 9:33:59 PM. PLT: 1s