Excel VBA : Create Custom Events In OOP

  Рет қаралды 4,802

MD ISMAIL Hosen

MD ISMAIL Hosen

Күн бұрын

Пікірлер: 23
@bot6731
@bot6731 Жыл бұрын
muy buen video , muy pocos aclaran este tipo de temas de crear eventos personalizados, justo venia investigando como incluir eventos personalizados a un proyecto. Eh visto un par de líneas que me parecieron muy interesantes el echo de instanciar un objeto y usar la función Create como un constructor es algo que se puede hacer de manera sencilla en Python pero en VBA no lo había visto antes y tenia la necesidad de implementar algo parecido. Muy agradecido por el aporte.
@mdismailhosen8280
@mdismailhosen8280 Жыл бұрын
Glad to help.
@mehmetturan8500
@mehmetturan8500 Жыл бұрын
thank you so much for useful video training
@mdismailhosen8280
@mdismailhosen8280 Жыл бұрын
Welcome.
@bot6731
@bot6731 Жыл бұрын
también me pareció interesante que hayas personalizado la cinta de opciones del VBE, voy a buscar en tus videos como personalizarlo, claro si ya subiste videos de como hacerlo, en todo es muy bien material para compartir, considero que a esa cinta del VBE le faltan algunas opciones mas.
@mdismailhosen8280
@mdismailhosen8280 Жыл бұрын
Please share your ideas to include in the video.
@antonioturner585
@antonioturner585 Жыл бұрын
Thanks for the video. I'm curious, how did you get the Create function to work? I tried to recreate it and I get an error Object required.
@mdismailhosen8280
@mdismailhosen8280 Жыл бұрын
Can you check if any difference is there in your code and my code?
@SolutionsByPVV
@SolutionsByPVV 8 ай бұрын
Hi, friend! Tell me how did you customize your VBE ?
@mdismailhosen8280
@mdismailhosen8280 8 ай бұрын
I am using Microsoft Extensibility 5.3 and a lot of my code.
@danp6101
@danp6101 Жыл бұрын
Hi Ismail. I have a question for you. I created a class module with my own custom Button click_event. The class uses Public withevents. Plus my own custom Mouse_Down event. This is for Activex buttons that will do something when I click on them or right click on them. There are up 480 buttons at one time that's why I used the class so I didn't have use the click_event for each one. I have Other modules that will performer other actions. Everything works fine. The Issue I am having is when I click on the Save icon up on the command bar. It says it saved to my PC but when I go close it buy hitting the X in the corner or by going to the left and click on the close. I get the Popup message do you want to save this file. with the options. Save, Don't Save, Cancel. No matter how many times I click on the save file icon it doesn't seem to save the file. I know it has something do with the class module because I Ran the macros without it calling the class all the other modules were called and the functions were performed. the only thing that doesn't work is the Button Click_Event and the MouseDown_Event which is controlled by the Class Module. Now when Click on the save icon it saves fine I don't get the popup message that says do you want to save this file. As soon as I reactivate the Class Module and try to save it then the popup message is back. Oh I Also have the Class to Set MyClass = Nothing After the Class is Called and on the WorkBook_Events BeforeClose and AfterSave_Event. I Still Get the Popup. Do you have any suggestions. Thanks.
@mdismailhosen8280
@mdismailhosen8280 Жыл бұрын
It’s really hard to understand the reason without seeing the code.
@danp6101
@danp6101 Жыл бұрын
@@mdismailhosen8280 Do you have an email
@mdismailhosen8280
@mdismailhosen8280 Жыл бұрын
1997ismail.hosen@gmail.com
@VipulKarkar
@VipulKarkar 2 жыл бұрын
What is the toolbar name that your are using for "Insert Constructor"?
@mdismailhosen8280
@mdismailhosen8280 2 жыл бұрын
Oh. It's not built in. It's my custom toolbar created by me.
@VipulKarkar
@VipulKarkar 2 жыл бұрын
@@mdismailhosen8280 oh, I thought Rubberduck has added this functionality. By the way, is this custom ribbon/commands available as an addin or do you have a github repo?
@mdismailhosen8280
@mdismailhosen8280 2 жыл бұрын
@@VipulKarkar It's in my personal addin. Not publically available. I have plan to release my addin in near future.
@VipulKarkar
@VipulKarkar 2 жыл бұрын
If you do not want to reinvent the wheel. Rubberduck has already this feature. Right-click variable and from rubberduck select "Encapsulate Variable/Member" it has the effect that your button is doing.
@mdismailhosen8280
@mdismailhosen8280 2 жыл бұрын
@@VipulKarkar encapsulate and constructor is not same thing. See rubber duck github repo. I have created an issue for constructor and they flag it as new feature.
@새벽별-t1t
@새벽별-t1t 6 ай бұрын
I've never seen it explained so easily. thank you But I think there is one more thing I need to learn. I copied and pasted the code into the file exactly like the teacher's code, but... EventDriver module Set CurrentPerson = Person.Create("Md.Ismail Name", 27) The above code does not recognize Person. An error message appears saying the variable is not defined. so... Dim CurrentPerson As New Person Set CurrentPerson = CurrentPerson.Create("Md.Ismail Name", 27) After modifying it like this, it works fine. What's the problem? If you download the teacher's file and run it, it will work. At that place... Dim CurrentPerson As Person Set CurrentPerson = Person.Create("Md.Ismail Name", 27) This is what happened and it worked well. '@PredeclaredId Is there something else that needs to be set in the VB editor to use this?
@mdismailhosen8280
@mdismailhosen8280 6 ай бұрын
Thank you. It means a lot to me. In the main file we have a metadata set to true which you can't see in the VBE Editor. That's what this PredeclaredId means. You need to do some google on PredeclaredId or watch my Factory method pattern video.
Sample Use Case of Factory Method and Interface
0:33
MD ISMAIL Hosen
Рет қаралды 344
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 43 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 14 МЛН
VBA Classes
40:43
Siddharth Rout
Рет қаралды 9 М.
VBA Classes - The Definitive Guide
31:03
Data Ben
Рет қаралды 36 М.
Creating Classes in VBA
10:19
Jennifer Garth
Рет қаралды 19 М.
How to Customize Controls in Excel VBA
18:23
Excel Macro Mastery
Рет қаралды 14 М.
Event Handler VBA Function for Multiple Controls in Microsoft Access Forms
8:19
Sports Fixtures Generator - A Real-World VBA Application
25:21
Excel Macro Mastery
Рет қаралды 12 М.
How to Use Class Interfaces in Excel VBA
20:16
Excel Macro Mastery
Рет қаралды 81 М.
Getters and Setters in VBA
10:30
Jennifer Garth
Рет қаралды 8 М.