Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Undefined function error | Excel Discussion (Misc queries) | |||
undefined function error when creating xls pivot from mdb qry | Excel Worksheet Functions | |||
2147217900 undefined function | Excel Programming | |||
'Undefined Function' Error in Microsoft Query | Excel Programming | |||
Excel 2000 VBA undefined function problem | Excel Programming |