Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Cristina Riley   on Nov 02 In MS Office Category.

  
Question Answered By: Aylin Kaya   on Nov 02

The way you have "chkTweak_ Click" here, there is a space after the
underline. chkTweak_Click is a single word.

chkTweak_Click HAS to be in the module that belongs to the sheet  or form
that chkTweak is located in. It SHOULD be defined as private, but I don't
think it makes any difference.

sbTheta can be private in the same module, or public in a module you create
yourself.

What do you mean by "did not work". If nothing at all happened, then you
don't have your click  routine in the right place, or it has the wrong name.

The best way to create a click routine is to go back to Excel, and turn  on
the control toolbar. Then put the spreadsheet into design mode  (from the
toolbar) and double-click your Tweak object. That will create proper event
subroutine in the right module. It might not be the click one, though -
just select the click event from the right-hand dropdown.

Once you've written your code, compile it through the "debug" menu in the VB
editor, and make sure it compiles cleanly. (However, bad naming or
positioning of event handlers will not show as compile errors.)

You are correct that event routines don't want to be called  from elsewhere,
even if they are declared as public. Indeed, no routines in the sheet
modules can be called in this way. I think the reason for this is that the
sheet module is actually a class module, not a normal module.

"Sometimes even from a sub in the same module." Technically incorrect.
Remembering that the event routine needs to be located in the module
associated with the object it services, it can then be called from other
routines in that same module.

You possibly need to post your code  here, and in this case you'll need to
mention which module each part of the code is located in.

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Calling a sub from another sub -- why the error message? Or get search suggestion and latest updates.


Tagged: