Compile Error: Procedure too large

  • Thread starter Thread starter Corey ....
  • Start date Start date
C

Corey ....

I am using the:
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
routine to run a series of macro's, but not i get the 'Too large error'.

I was thinking if i break up the code and place it into various Modules, and
using a 'Call" procedure to run the macro with this procedure instead.

However when i tried this it does not run.

Can i remove the 'Private' and use a 'Public' to get it to work?
 
You cannot put any userform events into any module other than the userform
module. What you have to do is extract parts of the code out into separate
procedures that you call from the event code, and put those procedures into
standard code modules.


Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)

'some standard userform, stuff

'now call a procedure passing the form as an objec variable

Call DoStuff(tHisForm:=Me)

'repeat this for discrete functional blocks
End Sub


in a standard code module

PUBLIC DoStuff(ByRef ThisForm as Object)

With ThisForm

...

End With
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top