Use Excel Add-in functions

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Use Excel Add-in functions

Post by agibsonsw »

Hello. 2003.
In Access VBA, how can I make use of Excel add-in functions, such as
NETWORKDAYS?
Thanks, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Use Excel Add-in functions

Post by HansV »

If you want to use workday calculations in Access, you can find a comprehensive series of VBA functions in Date/Time: Doing WorkDay Math in VBA on the Access Web.

It *is* possible to use the Analysis ToolPak functions in Access, but it involves running Excel, which is quite an overhead. Example:

Dim objXL As Object
Set objXL = CreateObject("Excel.Application")
objXL.RegisterXLL objXL.Application.LibraryPath & "\ANALYSIS\ANALYS32.XLL"
Debug.Print objXL.Run("NETWORKDAYS", #7/2/2010#, #7/19/2010#)
objXL.Quit
Set objXL = Nothing
Best wishes,
Hans

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Use Excel Add-in functions

Post by agibsonsw »

Hello.
Thanks for a very thorough response. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.