PDA

View Full Version : Unload frm1 - error (Wrong Number of Arguments)



Edgar
02-14-2007, 11:29 AM
I have been having the following problem for some time.

I have an add-in that I have created for work. I am able to create and open forms, but I always get an error when trying to unload the form.

The error is (Wrong Number of Arguments).

However, when I copy the form (and associated code) outside of the add-in to a regular workbook, the unload command works as expected.

I have this problem for the simplest of forms (like a calendar form). I have been forced to leave my forms running in the background by simplying hiding them.

Is there some kind of setting in the add-in that needs to be changed or interference between forms.

Any help would be appreciated.

Edgar

CBrine
02-14-2007, 12:36 PM
Edgar,
I'm currently working on an addin of my own. I have an exit button setup on the form that calls



unload me

Work without any issues. Not sure what's going wrong for you, but I don't believe it's the addin. Can you paste your exit code?

Cal

Edgar
02-14-2007, 01:22 PM
Here is the exit code:




Private Sub cmdClose_Click()
unload frmCalendar
End Sub

The form is named: frmCalendar

As I said, this exact code works fine in a module outside my add-in, but does not work in the add-in. None of the Unload commands work within the add-in.

CBrine
02-14-2007, 02:46 PM
That's pretty odd. The code should work fine? Have you tried disabling your error checking so you can get access to the debugging option in the addin? You should be able to also add breakpoints to the Addin code(Not the original workbook). I can't see the error messge coming from that code, it must be something else that your missing? Either that or something is wrong with your copy of excel.
You might also want to check the references in your addin code to make sure none are missing. Missing refereneces tend to make the code do unusual things.

HTH
Cal