Inheritance in VBA

Status
Not open for further replies.

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,924
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
We know there is limited inheritance in VBA and in order to use it, you would need to use the word with implements.

However, in my example below, is this an example of inheritance?

Class1:

Code:
    Private pabc As Integer


Public Property Let abc(ByVal vNewValue As Integer)


    Dim c As Class2
    Set c = New Class2
    
    c.cde = 20
    
End Property

Class2:

Code:
Private pcde As Integer


Public Property Let cde(ByVal vNewValue As Integer)
    
    pcde = vNewValue
    
End Property

Standard Module:

Code:
Sub Start()


    Dim x As Class1
    Set x = New Class1
    
    x.abc = 10


End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I have roles in column A and their corresponding entitlement in column B

I need a macro to pick the child role corresponding parent role

Role Entitlement
Role 1 Entitlement 7
Role 1 Entitlement 8
Role 1 Entitlement 9
Role 2 Entitlement 7
Role 2 Entitlement 8
Role 3 Entitlement 6
Role 3 Entitlement 7
Role 3 Entitlement 8
Role 3 Entitlement 9
Role 4 Entitlement 6
Role 5 Entitlement 9

Role 1 inherits Role 2 and Role 5
Role 3 inherits Role 4 and Role 1

Can I have a macro to identify the child roles
 
Upvote 0
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top