Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Moving Public Function From Workbook Module to XLA

I have a function that exists in a workbook module and it works when
called from the spreadsheet. If I move the code to a separate .XLA I
get a #NAME? like it can't see the moved function. If create the
function first in the .XLA it works, then move it the a workbook
module it works, but when I move it back to the .XLA I get the
#NAME?. If I delete the call in the cell and recreate it, it does not
help.

It's somewhat obvious to me that Excel has put the name in some
internal table but how can I see this and/or fix this? The actual
problem is more complicated and I can't rename the function but what I
describe above is a simplified version of my real problem.

Thanks,
Bruce

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Moving Public Function From Workbook Module to XLA

After you've removed the function and placed it into the .xla, try this:

In the workbook that lost that function (call it myFunc).

Insert|Name|Define
MyFunc
refers to $a$1
(of the activesheet)

Then delete that newly created name via Insert|Name|define.

Then finally, select the cells with the function (or all the cells)
edit|replace
what: = (equal sign)
with: = (equal sign)
replace all

Did it work?

Bruce wrote:

I have a function that exists in a workbook module and it works when
called from the spreadsheet. If I move the code to a separate .XLA I
get a #NAME? like it can't see the moved function. If create the
function first in the .XLA it works, then move it the a workbook
module it works, but when I move it back to the .XLA I get the
#NAME?. If I delete the call in the cell and recreate it, it does not
help.

It's somewhat obvious to me that Excel has put the name in some
internal table but how can I see this and/or fix this? The actual
problem is more complicated and I can't rename the function but what I
describe above is a simplified version of my real problem.

Thanks,
Bruce


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Moving Public Function From Workbook Module to XLA

You are a genius, it worked great. The good thing about this solution
is that it's trivial to do. It's hard to explain but I'd like to be
able to do this 'move' somewhat regularly.

Thanks,
Bruce

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Moving Public Function From Workbook Module to XLA

When I'm developing a UDF, I'll put it in a test workbook. Then take as much
time as I need to get it running there.

When it's working perfektly(!), I move it to its real home and just delete that
test workbook file. If I need to test the UDF in a cell in a real workbook,
I'll just fully qualify it:

=testworkbooknamehere.xls!myfunct(....)



Bruce wrote:

You are a genius, it worked great. The good thing about this solution
is that it's trivial to do. It's hard to explain but I'd like to be
able to do this 'move' somewhat regularly.

Thanks,
Bruce


--

Dave Peterson
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
Declaring variables in Module vs. Public Jeff Excel Discussion (Misc queries) 5 November 19th 07 08:27 PM
compiler error: public object module Wang Excel Programming 2 September 24th 06 08:31 PM
How to add a public subroutine to a class module keithb Excel Programming 2 December 19th 05 08:36 PM
How to reference a public array (declared in module) from a proced Amzee Excel Programming 3 January 11th 05 06:26 PM
Passing Public Module Vairable to a Worksheet Event SMS - John Howard Excel Programming 1 November 4th 04 08:33 AM


All times are GMT +1. The time now is 02:33 AM.

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

About Us

"It's about Microsoft Excel"