![]() |
Undefined function
I've place a command button on Sheet1. In the click event I call a user
defined public function which I created in the ThisWorkbook module called Init. When I click on the command button, I get an error: "Sub or Function not defined." It is a public function and there are no spelling errors. Why am I getting the error? Thanks. |
Undefined function
Try putting it in a standard module, instead of thisworkbook.
-- HTH... Jim Thomlinson "q" wrote: I've place a command button on Sheet1. In the click event I call a user defined public function which I created in the ThisWorkbook module called Init. When I click on the command button, I get an error: "Sub or Function not defined." It is a public function and there are no spelling errors. Why am I getting the error? Thanks. |
Undefined function
I can't put it in a standard module. It uses an active X control that must
be instantiated in the ThisWorkbook module. (I think this is because I am using the "with events" keyword, though I am not sure why that means it has to be in the ThisWorkbook module.) Therefore, in order to use the active X object, I must also have this routine in that module. The only way I can figure that I can call the routine using a user interface object like a command button, is to call the procedure from the click event of the command button. (I cannot place that same function code in the Click event procedure because the ActiveX object is not recognized in that click event procedure - only in the procedure when it is contained in the ThisWorkbook module!) I'm stuck. "Jim Thomlinson" wrote in message ... Try putting it in a standard module, instead of thisworkbook. -- HTH... Jim Thomlinson "q" wrote: I've place a command button on Sheet1. In the click event I call a user defined public function which I created in the ThisWorkbook module called Init. When I click on the command button, I get an error: "Sub or Function not defined." It is a public function and there are no spelling errors. Why am I getting the error? Thanks. |
Undefined function
I'm stuck between a rock and a hard place. I am using an ActiveX control
that MUST be instantiated in the ThisWorkbook module (I believe this has something to do with the fact that I am using it with the "With Events" keyword). Therefore, my references to that public object must also be in that module or they will not be recognized. However, I want to initialize it using a user interface object (command button). But, alas, Excel for some reason considers the function in the ThisWorkbook module to be undefined when called from the Sheet1 object module. I'm stuck. "Jim Thomlinson" wrote in message ... Try putting it in a standard module, instead of thisworkbook. -- HTH... Jim Thomlinson "q" wrote: I've place a command button on Sheet1. In the click event I call a user defined public function which I created in the ThisWorkbook module called Init. When I click on the command button, I get an error: "Sub or Function not defined." It is a public function and there are no spelling errors. Why am I getting the error? Thanks. |
Undefined function
This is really strange - I am getting an error when I post saying that the
message cannot be posted because there are too many connections to my mailserver from me - but it is getting posted anyway! Sorry about that. "Jim Thomlinson" wrote in message ... Try putting it in a standard module, instead of thisworkbook. -- HTH... Jim Thomlinson "q" wrote: I've place a command button on Sheet1. In the click event I call a user defined public function which I created in the ThisWorkbook module called Init. When I click on the command button, I get an error: "Sub or Function not defined." It is a public function and there are no spelling errors. Why am I getting the error? Thanks. |
All times are GMT +1. The time now is 02:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com