Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
q q is offline
external usenet poster
 
Posts: 6
Default 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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default 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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
q q is offline
external usenet poster
 
Posts: 6
Default 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.






  #4   Report Post  
Posted to microsoft.public.excel.programming
q q is offline
external usenet poster
 
Posts: 6
Default 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.






  #5   Report Post  
Posted to microsoft.public.excel.programming
q q is offline
external usenet poster
 
Posts: 6
Default 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.








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined function error CLamar Excel Discussion (Misc queries) 3 June 5th 06 07:07 PM
undefined function error when creating xls pivot from mdb qry andrew Excel Worksheet Functions 0 July 29th 05 07:26 PM
2147217900 undefined function jinsong Excel Programming 1 June 29th 04 04:23 PM
'Undefined Function' Error in Microsoft Query Jim Molter[_2_] Excel Programming 1 September 9th 03 11:20 AM
Excel 2000 VBA undefined function problem Matt. Excel Programming 1 August 8th 03 04:17 PM


All times are GMT +1. The time now is 11:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"