View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob B Bob B is offline
external usenet poster
 
Posts: 2
Default Accessing the Bessel Function within VBA in Excel 2007

I am not sure I understand the replies. Let me keep things simple. This
applies only to Excel 2007. In Office 2007 I open a new work book, go to
Excel options, then add-ins and verify that the add-in 'Analysis ToolPak' and
'Analysis ToolPak - VBA' are there. I then open the VBA editor and got to
Tools, references and verify that 'atpvbaen.xls' (which is an Excel 2007
version) is checked. Click OK.

I then go to the object browser (F2) in the VBA editor window, select all
libraries and look at the window 'Members of Globals' . The engineering
function BesselK function is not there. In Excel 2003 the function BesselK
was there (and is actually in the Office 2003 'atpvbaen.xls' library). Where
is it now in Excel 2007? The same is true of the CONVERT function. It is not
in Excel 2007 but does show up in Excel 2003.
--
Bob B


"JLGWhiz" wrote:

Check under engineering functions:

http://office.microsoft.com/en-us/ex...042111033.aspx

Also from previous posting:

Can I use Analysis ToolPak functions in my VBA code?
Yes, but it takes a few extra steps. In Excel, choose Tools/Add-Ins, and
place a
check mark next to the add-in named Analysis ToolPak - VBA. Then activate your
VB project and choose Tools/References. Place a check mark next to
atpvbaen.xls
to create a reference. Then you can use any of the Analysis ToolPak functions
in your code. For example, the following statement uses the Analysis ToolPaks
CONVERT function, and converts 5,000 meters to miles:
MsgBox CONVERT(5000, €œm€, €œmi€)



"Bob B" wrote:

In versions of Excel prior to Excel 2007 one could address VBA Bessel
functions (as opposed to Worksheet functions) by ensuring one had a VBA
reference to ATPVBAEN.XLA. The object browser had all sorts of obscure
mathematical functions in it. With Excel 2007, these functions have been
removed from this library. I see no other libraries that have them. One can
always use the WORKSHEETFUNCTION that gets you to these math functions.
However I do not want to reference worksheet cells directly , just local
variables, due to a possible performance hit. Can I use local variables in
the argument list instead of cell references in WORKSHEETFUNCTION.

Also how would I maintain one code base that will run in Excel 2007 and
earlier versions, if I am forced down this path of using WORKSHEETFUNCTION? I
can use the application.version function to test for different Excel versions
but I get a compile error in the pre-Excel 2007 code fragment in Excel 2007
when it cannot see the bessel function itself (as the library is missing) Any
suggestions?
--
Bob B