Thread: Placing an UDF
View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
yshridhar yshridhar is offline
external usenet poster
 
Posts: 229
Default Placing an UDF

Thanks alot Mr. Biff for your elaborate explanations. What we want is that
to clear our doubts and resolve our problems. Thanks alot again for your
EXCELlent suggestion and explanations.
With regards
Sridhar


"T. Valko" wrote:

Sorry, I didn't answer your other question:

How to store this UDF as an ADDIN


Basically, it's the same process but you give the file a different file
extension and you save it to a different location. Although you can save it
to other locations MS has a location just for add-ins. Notice I didn't use
the words have to or special. I don't want to argue about semantics with
anyone!

I'll describe the procedure from the very beginning.

Start Excel
It opens with the default file name of Book1
Hit ALT F11, this will open the VB editor
Hit CTRL R, this will open the project explorer pane on the left side of the
window
Look for VBAProject(Book1) in the explorer pane
Select it, then right click
Select InsertModule
Paste your UDF code in the window that opens on the right
Hit ALT Q to return to Excel
Now, save the file and name it Personal.xla. You should save the file to the
directory named AddIns. I'm using Windows XP with Excel 2002. The
path to my AddIns directory is:

C:\Documents and Settings\User\Application Data\Microsoft\AddIns

Now close Excel. Wait a minute or two then reopen Excel.
You need to load the add-in
Goto the menu ToolsAdd-Ins
You should see the Personal.xla file listed.
Select Personal.xla then click OK
You should be good to go!

Now, you can use this function just like any other function:

=MyFunction(...)


--
Biff
Microsoft Excel MVP


"yshridhar" wrote in message
...
Thanks alot Mr. Biff for your detailed explanation. But i a facing a
problem. When i open excel the personal.xls is also opening in another
window. How to hide it? How to store this UDF as an ADDIN
Sridhar


"T. Valko" wrote:

To make a UDF available to all workbooks you have to store it in a
special
file called Personal.xls.

Personal.xls is a hidden file that opens wth Excel.

If you do not already have a Personal.xls file then you'll have to create
it.

Start Excel
It opens with the default file name of Book1
Hit ALT F11, this will open the VB editor
Hit CTRL R, this will open the project explorer pane on the left side of
the
window
Look for VBAProject(Book1) in the explorer pane
Select it, then right click
Select InsertModule
Paste your UDF code in the window that opens on the right
Hit ALT Q to return to Excel
Now, save the file and name it Personal.xls. You have to save the file to
a
special directory named XLStart. I'm using Windows XP with Excel 2002.
The
path to my XLStart directory is:

C:\Documents and Settings\User\Application Data\Microsoft\Excel\XLStart

Yours may be different but you need to find the XLStart directory and
save
the file to that location.

Then, when you want to use the UDF in any workbook you call it like this:

=Personal.xls!your_function_name(...)

For example, suppose the function name is FindAll:

=Personal.xls!FindAll(...)

You have to replace the "..." with any arguments your function may take.

--
Biff
Microsoft Excel MVP


"yshridhar" wrote in message
...
I have an User Defined Function sent by EXCEL group. Where shall i
place
this to use it as a normal worksheet function in any excel file i open.
eg
like SUM, AVERAGE?
Thanks
Sridhar