View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Excel VBA 2003: how do I call an Analysis ToolPak function within

This is the first time I played around with using the Analysis ToolPak in
VBA... I just discovered what you posted, so I won't post it again; however,
I do notice on my copy of XL2003 that running code with an EOMONTH function
call in it produces two lines of print out in my Immediate Window (I have my
VB Editor window open also), namely this...

[GetMacroRegId] 'EOMONTH' <
[GetMacroRegId] 'EOMONTH' - '1677852726'

Other calls to Analysis ToolPak functions also seem to produce two lines of
printout to my Immediate Window as well. I am **not** purposefully doing any
debugging, so why is this "extra" information being sent to my Immediate
Window (assuming you are seeing the same thing)? I'm thinking that if I set
up a lot of Debug.Print statements in code during a debug session that ran
one or more Analysis ToolPak function calls later on in the code, my initial
Debug.Print results could be lost if these extra lines of "unasked for"
printout to the Immediate Window cause its buffer to overflow. Again,
assuming you see the same printouts as I just described, do you know if
there is a way to "turn them off"?

--
Rick (MVP - Excel)



"JLatham" wrote in message
...
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?