View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Hershmab Hershmab is offline
external usenet poster
 
Posts: 35
Default Excel VBA 2003: how do I call an Analysis ToolPak function wit



"JLatham" wrote:

In addition to 'installing' the Analysis ToolPak along with 'Analysis ToolPak
- VBA', in the VB Editor, set a Reference (Tools -- References) to
atpvbaen.xls
It should be in the list of available library references. Then you can code
it simply as:

Sub TestEOMonth()
Dim newDate As Date

newDate = eomonth("1/1/2010", -1)
MsgBox newDate
End Sub


"Hershmab" wrote:

Analysis ToolPak is installed in my application and I need to use the result
of EOMONTH function in a UDF I am writing. These functions are clearly not
amongst the properties/methods of APPLICATION.WORKSHEETFUNCTIONS.

I tried this syntax:
PrevMthEnd = [atpvbaen.xla]!EOMONTH(Date, -1)
but it also does not work.

How should it actually be worded?


(Sorry for delay in answering,but I must have forgotten to be notified of
replies!)

I have tried out your suggestion. Once I realised that the Tools menu you
referred to was in the VBE, not Excel itself, I set up the reference and it
appears to be working.

Thanks