| |

VerySource

 Forgot password?
 Register
Search
View: 1152|Reply: 4

Ask a question about Excel's VBA programming interface about custom form names

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-15 09:30:01
| Show all posts |Read mode
I found a problem when using Excel's VBA programming interface.
That is, I create a new form, the system name is userForm, I changed the name property of this form to
frmFind, and save it. It is found that the name of the form in the drop-down box of the upper left corner of the editor entered in the VBA code is still userForm, and the corresponding click event generation process is also called UserForm_Click (), not frmFind_Click (). You must manually modify UserForm_Click () to frmFind_Click (). Is there any way to make the VBA code editor like VB to automatically change the name of the event handler function of the form?
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-6-17 22:45:01
| Show all posts
Why do you have to manually modify frmFind_Click() every time? No problem if you don’t change it UserForm_Click()
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-6-22 16:00:01
| Show all posts
tohxl_zorro
According to the requirements of software engineering that I have studied, each form should have its own special name. I use frm + to represent the abbreviation of the form's use name. For example, the role of frmFind is to find related Excel records.
If each form is a userForm, the project is a big one, and when there are dozens of forms, I can't figure it out myself. It is much more troublesome to maintain.
It is still necessary to develop a good coding style to meet the requirements of software engineering.
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-8-6 12:15:01
| Show all posts
Brother, did I tell you not to change the window name? ?
Whether you use frmEnd as the name of the window, or whatever else, the sub of this window is still userform_click
You try frmFind_Click(), do you see the click event occurs when you click on the window?
VB and VBA are not exactly the same! ! !
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-8-6 12:30:01
| Show all posts
Brother, there are some things you have to try yourself before coming here to say it's better
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list