How to Use Class Interfaces in Excel VBA

preview_player
Показать описание
👉 Ready to master VBA?
(Note: If the download page doesn't work then make sure to turn off any popup blockers)

How to Use Class Interfaces in Excel VBA

In this video I cover VBA Interfaces. So what are interfaces and why do you need them?
We use Interaces with class modules and they allow use to write some really useful code.

If you have only use Class Modules in a basic way you may not understand there use. But using powerful techniques like VBA interfaces allows us to do some really interesting things as you will see in the video.

Interfaces are part of what we call Object Oriented code design. Don't be put by the jargon or complex sounding name. I will show simple and practical uses of Interfaces. Once you understand them you can easily use them in the future in your VBA code.


#vbaclass #vbaclassinterface #vbainheritance

Related Articles


Useful VBA Shortcut Keys
========================
Search keyword under cursor: Ctrl + F3
Search the word last searched for: F3
Compile the code: Alt + D + C OR Alt + D + Enter
Run the code from the current sub: F5
Step into the code line by line: F8
Add a breakpoint to pause the code: F9(or click left margin)
View the Immediate Window: Ctrl + G
View the Watch Window: Alt + V + H
Auto complete word: Ctrl + Space

Get the definition of the item under the cursor: Shift + F2
Go to the last cursor position: Ctrl + Shift + F2
Switch between Excel and the VBA Editor: Alt + F11
View the Project Explorer Window: Ctrl + R
Get the current region on a worksheet: Ctrl + Shift + 8(or Ctrl + *)
To move lines of code to the right(Indent): Tab
To move lines of code to the left(Outdent): Shift + Tab
Delete a Line: Ctrl + Y
View the Properties Window: F4
Рекомендации по теме
Комментарии
Автор

I had no idea and didn't expect VBA to have Interface like full-fledged OOP languages (although isn't a complete match) and I am sure too few people are aware of it's existence in VBA. Paul's enthusiasm in exploring both vertically and horizontally has touched every possible segments of VBA. Having confidence on teachers credentials/abilities important for learners and Paul has earned that very successfully.

mrashid
Автор

Hi,
you're the ultimate-VBA Boss!
I program in VBA since 1998, in Excel and AutoCAD. Till now I thought Im quite good at it. Now I have to change my mind ;)
Thank you!

aszarek
Автор

I’m going to have to watch this more than once. 🤯🤣

philipmcdonnell
Автор

I hope you enjoy this video on the little known subject of VBA Interfaces. Let me know in the comments if you think you could benefit from using Class Interfaces or if you find them a bit too complex.

Excelmacromastery
Автор

Fantastic! Never expected that VBA actually offers interface class. This kind of material differentiates you from all other YouTube Excel tutorials.

rdchenweb
Автор

What? Interfaces in VBA? Man, you definitely are the Final Boss of this game called Excel VBA. Always a pleasure to watch your videos for an express refresher and to learn tiny brilliant things that make our code look more professional and our lives easier.

I haven't watched the video yet, but I don't doubt you have delivered yet another masterclass.

oz
Автор

I never understood interfaces until you showed this example. Thank you!

karenjoy
Автор

This is by far the most complex video of yours... I need to go through it again and again

rrrprogram
Автор

We implemented these interface to four readings from an electronic instrument and was fantastic. I created a class interface and read current, voltage dc and ac and frequency of the signal in real time from the created object. now i will correlate all these reading implementing a reading every second calling another time object from a generic class., thanks for the tips it was very helpful.

cessromer
Автор

surprised, never knew that VBA can implement interfaces or classes methods/properties although i use classes in my practice. As it's spoken: live and learn forever. Thanks a lot. The best VBA channel I've ever met

GanovAlex
Автор

These longer videos which demonstrate coding entire projects are very helpful. I especially like the last one where you show how to use Enum for row/column locations and store/return multiple values in a function. Before, I was declaring public variables for all of those things. More of these types of videos and OOP concepts would be great! THANK YOU!

davidlinesq
Автор

It was not too complicated, 🙂 it was perfect!!

shanewilliams
Автор

Shortly after watching this video I was in need of a solution to create a class constructor with parameters, which is solved, amongst other things, with interfaces (as long as one wants a neat solution). It was then when a whole new world in VBA opened before my eyes. It was also thanks to my C# knowledge that I could understand most of the "new" concepts I had no idea existed in VBA. But here comes the best part: my familiarity with VBA has helped me better understand those concepts I only knew of in C#! In other words, I not only have better coding techniques at my disposal in VBA now but everything has fallen into place for C# too! Cool!

oz
Автор

Master level confirmed! Just a shame there is only one like I can give!
Never had the need for an interface in VBA or I hacked my way around :-) It's clearly neater the way you showed!

thearchibaldtuttle
Автор

Finally I found someone who’s using OOP in VBA. After several tutorials on VBA I thought that there’s no OOP in VBA at all.

phat
Автор

This is a type of video i think i will benefit from if i watch it a couple of more times. Thank you!

reevesjim
Автор

Having coded in other languages, like Python, JavaScript, and C#, I always thought VBA was a sort of toy language...
That is, until I saw your stellar videos!

Thank you so much for your detailed and easy-to-follow tutorials on game-changing language/API features.
You've saved me more times at my job than I can count!

rahuldevstech
Автор

Thanks Paul - I am not sure "complex" is the right word/description. It's just a different way of approaching the problems. For me, I tried recently to get into (hadn't gotten to interfaces yet!)....and after struggling for two solid weeks - even with part -time expert help - I went "back' to good ol' arrays, functions and subs, and knocked out my fairly complex application in a couple days. I am not really proud of that, as I wanted to up my game. I learned that 30+ years of writing crappy BASIC and VBA code just doesn't prepare one for this next step up, lol. Not giving up...but this a real-world account from one amateur coder.

terrycline
Автор

Your work is very helpful, when I first see your videos, I think that is very interesting, but don't necessarily have a problem that needs the solution, several months later, the light bulb goes off, Oh...that is where this is useful.

stevennye
Автор

Thank you for this. This is one of the few videos of yours I’ve seen, where I’m going to have to watch it a few times over, in order to understand what’s going on. I am a self-taught VBA coder who knows nothing of other languages, so the concepts are difficult to grasp after one viewing. I have no doubt that this is very powerful stuff, but as a few of your other commenters have said, in my somewhat naive approach to Excel/VBA, I would have done this using standard subs, functions, select cases, etc. Will persevere with your very helpful videos, though! Thanks again.

iankr