View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Multiple Userform Macro Headache

renaming initialize just causes it not to fire, so there is nothing magic
there.

It sounds like you have a duplicate name defined somewhere. Maybe you named
a variable userform or named a procedure Userform.

You may need to find this problem and change it, then rebuild your project
use Rob Bovey's free code cleaner utility
http://www.appspro.com - goto downloads

--
Regards,
Tom Ogilvy


" wrote:

Hello all,

This is my first time posting to this group, so I'm sorry if I
(unintentionally) don't follow proper conventions.

My problem is with creating a macro that utilizes multiple userforms.
Of course, this means that each userform has its own name, own code,
etc. The problem lies with the Userform_Initialize() event. If I use
this code:

PartsFindForm.Show 'where PartsFindForm is the name of the userform

Userform_Initialize() gives me an error and Excel refuses to run until
I change the name to PartsFindForm_Initialize(). Of course, Excel then
no longer recognizes this as an event and skips any code inside the
Sub. What should I do to make this work? As of now I am running
everything with the Userform_Activate() event which works perfectly
(like Initialize() should) with the problem that code that I only want
running once gets run multiple times. This error also occurs with Load,
Hide, and any other Userform specific commands.

Any help would be greatly appreciated! Thank you.

-Larry