Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch Error 13 calling a procedure in Userform1

Status
Not open for further replies.

JazzyLee

Programmer
Jan 24, 2002
47
US
I have a Userform with a sub procedure call Userform_Initialize. I have a button on an Excel sheet with a sub procedure in Module1 assigned to it. This sub has one statement in in : Call Userform1.Userform_Initialize. When I click on this button, the procedure was called, all the initialization would occur and then it would show my userform. It use to work in Win95/Excel 97 but now that I switched to Win2000/Excel 2000, I get an error on this call line which says 'Run-time error "13", Type mismatch'. I can't get past this point ... HELP! PLEASE!
 
Try changing the name. There is now an Initialize Event for form classes...at least in VB6 of which VBA for Office 2000 is a subset. It is probably UserForm_Initialize and expecting different parameters. Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
I have the name as UserForm_Initialize. What do you mean by it 'expecting different parameters'? Do I need something after the procedure name?
 
Hello JazzyLee,

Perhaps posting the code which gives the Error 13: Type Mismatch would help us help you better.

Also, have you tried using:

Load UserForm1

instead of:

Call UserForm1.UserForm_Initalize


Normally, event handlers are declared as Private and calling them from other modules usually gets a 'Method or Data Member not found' error message (instead of a Type Mismatch).

Loading the user form (Load UserForm1) loads the form into memory and also initializes the form. It won't dispay the form until you add UserForm1.Show somewhere in your code.

Hope this helps,
Pete
 
Did you follow my advice.
"Try changing the name". The rest is an explanation. It boils down to UserForm_Initialize is an Event in the UserForm in Office 2000. You can not use it as a procedure name. There is nothing you can do but get your UserForm_Initialize procedure out of the way. Change the name of your procedure.

Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top