Inheritance in VBA

Status
Not open for further replies.

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,834
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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
No, it isn't.
 
Upvote 0
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,216,373
Messages
6,130,238
Members
449,568
Latest member
mwl_y

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