VBA Classes

preview_player
Показать описание
In this video I explain about classes. Things that we cover is

What are classes?
Why do we need classes?
What are properties, methods and events w.r.t classes
and so many other things

This video will be my building block for my next video which will explain about Object Oriented Programming in VBA so if you are not aware what classes are and how they work then I recommend watching this video.

----
00:00 Intro
04:54 Properties
05:52 Get, Set and Let
08:22 Creating an Object of a Class
12:33 Methods
29:16 Events
39:26 Outro
----

Software used for recording and editing this video

Disclaimer: The above is an affiliate link. At no additional cost to you, we will receive a small commission if you make a purchase using the above links. This helps support the channel. Thank you in advance for your support!

Connect with me on social:

#ExcelVBA #ExcelMacro #VBAExcel #MSExcel #Excel
Рекомендации по теме
Комментарии
Автор

Thinking about diving into Object-Oriented Programming (OOP) in a future video! 📚 If you’re interested, drop a comment below and let me know! The more interest we get, the sooner I can make it happen! 👇💬 #OOP #CodingCommunity #LetMeKnow

SiddharthRout
Автор

Holy moly! I’ve been scripting with VBA for years but struggled with understanding classes. This is the video I needed. This new knowledge will help me right away in a project I am working on. Thank you!

MyFakeBrand
Автор

Hi Siddharth, this is my first time on your channel and I hit the subscribe button after only two minutes. Your easy to understand explanation at the beginning of the video has already convinced me. Well done! Keep up the good work!

RInvestments
Автор

Great, clear, instructive video on classes using vba. Added it to my references of recommended sample code.

orange
Автор

Thanks for the explanation mr. Sidd. OOP is great if you want to be a good developer (i think). I've read a lot of concepts from internet, but there are misunderstanding data. This way is great. 🤗🤗

JiriMerkl
Автор

Loved the way you explained. Thank you!! 😄

Keep it up!

ramandeepsr
Автор

Excellent video Sid - very instructive!

kevinmccurley
Автор

Хоть и не на русском но я все равно понял основу принципа работы. Самый хороший обзор. Большое спасибо брат! Успехов твоему каналу. 🤝

ВиленДаутов
Автор

EXCELLENT using real world example makes it so much easier to understand! - a couple of small requests/suggestions. Could you step through the code and explain as the program runs - it helps to understand the process flow. As you advance set breakpoints so there is not a lot of repetition. A second request/suggestion is to show how to crerate a user interface - perhaps as a follow up video? - A REALLY great job!!!...

MyPhotographic
Автор

Why do you use composition?

You could have declared a variable in the standard module, such as Dim MyVariable As Gear.

Then in Sub DriveCar, you can replace .TheGear.GearUp with MyVariable.GearUp.

Similarly for .TheGear.GearDown with MyVariable.GearDown.

How does using TheCar.TheGear.GearUp help? I think it confuses people (certianly me)!

Thanks

noviceprogrammer
Автор

Can you upload again the file ? it was deleted

xxrocoxx
Автор

Hi,

I'm been waiting for your "next video" on OOP.

Do you plan to release it anytime soon?

noviceprogrammer
Автор

I created classes just so I can move multiple variables via a dictionary. Should I instead move the code that uses the variables into the class methods and just instantiate the class every time I need to manipulate data associated with the class?

KrazyMO
Автор

I couldn't understand how event Works in class Module, you should have created this video in multiple parts in details by telling each and every concepts line by line.. 😂
I want to learn WithEvent and Raise Event concept in details, so make a Video on these topics as well.

KuldeepSingh-nqvi
Автор

The code in the downloaded workbook is different to the video.

Sub MyCarExperience()
CreateNewCar
FillFuel
DriveTheCar

Dim CarTyreState As Double
CarTyreState = TheCar.TheTyre.TyreCondition

If CarTyreState < 40 Then
MsgBox "Car Tyre Condition: " & CarTyreState & "." _
& vbNewLine & "We will replace tyres now"

Set TheCar.TheTyre = New Tyre

MsgBox "Car tyres have been replaced."
MsgBox "Car Tyre Condition: " & CarTyreState & "."
End If

Set TheCar = Nothing
End Sub

This line is wrong in the download:

MsgBox "Car Tyre Condition: " & CarTyreState & "."

but it's correct in the video.

noviceprogrammer