# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  Renaming a Userform in Excel VBA

## radiocam

Hi, Would appreciate _any_ help with this:

I've been refreshing myself on VBA after a while away from it,  and am trying some VERY basic VBA stuff in Excel.
OK, so I ...
1. insert a Userform in my project
2. It gets called Userform by default, so I want to change the name.
3. So I go into the userform properties and change the name, to let's say: usrTestForm
4. The properties window certainly shows that the name has changed. 
5 BUT... If I now highlight the userform in the navigator tree, right click and select "view code"...
6. when I drop down the code object window, I only see code subroutines for "Userform".
7. And if I click on the Userform to generate a Click subroutine, when I go and look at the code, it has generated it for Userform_Click. 
This is driving me crazy because I have tried it on two PCs, one running win 7 + Excel 2007 and the other Win 7 64b + Excel 2003  and they both do the same thing. It can only be something I'm doing wrong - or something common to Win 7, but I haven't the foggiest why...
It's like there's an "internal" name that it does not change even though it shows the changed name in the properties panel,

Thanks in advance!

----------


## barryleajo

radiocam I'm no expert but I think this is how it is supposed to work.
I haven't known anything different.
You can also change the Caption property which will give the userfom an 'identitty' in its title banner.

You may of course be thinking of the names of the various userform controls which ARE identified by name within the code/window change events
barry

----------


## romperstomper

Barry is quite correct. Those events never change regardless of what your form is called (they are inherited from the base userform class)

----------


## radiocam

Thanks guys,
That's a relief. I honestly could not remember that it behaved that way and I confused myself along the way by trying to change one of the UserForm_Click type subs (can't remember which one) to something like the new name_Click - and VBA didn't like_ that_ at ALL.

Many thanks for the replies - I was starting to spin my wheels seriously on this, all for nothing .... sigh ....


Cheers.

----------


## romperstomper

If you are satisfied with the solution(s) provided, please mark your thread as Solved. 

How to mark a thread Solved
Go to the *first* post 
Click edit
Click Go Advanced
Just below the word *Title* you will see a dropdown with the word No prefix.
Change to Solved
Click Save

----------

