Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default using a function in an addin in my vba code

how do I use a function from an addin in my vba code. For example, I have
the "Analysis ToolPak - VBA" addin installed and I want to do something
like:

NumOfDays = worksheetfunction.networkdays(startdate,enddate,my range)

this line of code doesn't work because networkdays is in the "Analysis
ToolPak - VBA" addin, not the standard worksheet functions.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default using a function in an addin in my vba code

found this for you..

Ole P. Erlandsen wrote on April 27, 2003 04:29 EST
If you want to use functions from the Analysis Tool Pack addin in your
own macros:
- Open the VBE (Alt+F11).
- Activate the project where you want to use the function(s).
- Select Tools, References... and check the option atpvbaen.xls.
- click the OK-button to close the References-dialog.

The macros in the workbook where you added the reference to the
atpvbaen.xls library can now use the functions like this:

workdaycount = networkdays(Date, Date + 14)

Or like this to avoid conflict with other user defined functions with
the same name:

workdaycount = [atpvbaen.xls].networkdays(Date, Date + 14)

It is not necessary to install the Analysis Tool Pack addin from the
menu Tools, Add-Ins...

The DATE() and YEAR() worksheet functions are not necessary in VBA where
you use the built-in functions Date and Year:

Today = Date
Tomorrow = Date + 1
CurrentYear = Year(Date)
NextYear = Year(Date) + 1



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"archangel" wrote:

how do I use a function from an addin in my vba code. For example, I
have the "Analysis ToolPak - VBA" addin installed and I want to do
something like:

NumOfDays = worksheetfunction.networkdays(startdate,enddate,my range)

this line of code doesn't work because networkdays is in the
"Analysis ToolPak - VBA" addin, not the standard worksheet functions.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default using a function in an addin in my vba code

Thanks for the fast response.

Unfortunately, it doesn't seem to be working. It may be because my vba code
is actually part of a user-defined worksheet function that I'm creating.




"keepitcool" wrote in message
...
found this for you..

Ole P. Erlandsen wrote on April 27, 2003 04:29 EST
If you want to use functions from the Analysis Tool Pack addin in your
own macros:
- Open the VBE (Alt+F11).
- Activate the project where you want to use the function(s).
- Select Tools, References... and check the option atpvbaen.xls.
- click the OK-button to close the References-dialog.

The macros in the workbook where you added the reference to the
atpvbaen.xls library can now use the functions like this:

workdaycount = networkdays(Date, Date + 14)

Or like this to avoid conflict with other user defined functions with
the same name:

workdaycount = [atpvbaen.xls].networkdays(Date, Date + 14)

It is not necessary to install the Analysis Tool Pack addin from the
menu Tools, Add-Ins...

The DATE() and YEAR() worksheet functions are not necessary in VBA where
you use the built-in functions Date and Year:

Today = Date
Tomorrow = Date + 1
CurrentYear = Year(Date)
NextYear = Year(Date) + 1



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"archangel" wrote:

how do I use a function from an addin in my vba code. For example, I
have the "Analysis ToolPak - VBA" addin installed and I want to do
something like:

NumOfDays = worksheetfunction.networkdays(startdate,enddate,my range)

this line of code doesn't work because networkdays is in the
"Analysis ToolPak - VBA" addin, not the standard worksheet functions.







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
how can I insert code for F4 function key? Pennyc Excel Discussion (Misc queries) 0 May 28th 09 06:56 PM
function or code? hal Excel Worksheet Functions 3 September 25th 08 08:14 PM
FUNCTION OR CODE ? tomjoe Excel Worksheet Functions 5 February 18th 08 05:39 PM
An AddIn for a custom function FARAZ QURESHI Excel Discussion (Misc queries) 3 October 16th 07 02:35 PM
Function or Code Allan Excel Worksheet Functions 2 March 16th 05 06:55 PM


All times are GMT +1. The time now is 03:45 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"