|
Question : Using XIRR in ACCESS , SQL TO VBA Conversions , Getting Runtime Error 1004
|
|
Hello, I am trying to use the XIRR function in access. It is not a built in function so I have to call it from excel somehow. When I try to use the code in the bottom of this page , I get runtime 1004 error saying macro XIRR cannot be found. I am confused XIRR is just a function not a macro. How can i modify this so it will work thanks,
Option Compare Database Option Explicit
Sub robertos() Dim xlApp As Excel.Application Dim xlWb As Object Dim x As Double Dim sqvalue As String Dim sqdate As String
Set xlApp = New Excel.Application xlApp.RegisterXLL xlApp.Application.LibraryPath & "\Analysis\ATPVBAEN.XLA" sqvalue = "Select Dowjones.Close" & "FROM [Dowjones]" & "WHERE (Dowjones.Index={'" & [Forms]![sear12X]![tindex] & "'})" sqdate = "Select Dowjones.Date" & "FROM [Dowjones]" & "WHERE (Dowjones.Gunay={'" & [Forms]![sear12X]![tstart] & "'})"
x = xlApp.Run("XIRR", sqvalue, sqdate, 1) * 100 xlWb.Close False Set xlWb = Nothing xlApp.Quit Set xlApp = Nothing End Sub
|
|
Answer : Using XIRR in ACCESS , SQL TO VBA Conversions , Getting Runtime Error 1004
|
|
awesomejohn19 said: >>My boss wants me to create it with IRR so I can't say anything.
Sure you can: you can remind your boss that there are far better ways to evaluate investment opportunities.
Have a look at this post: http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_21620148.html#15230768
It demonstrates just how dangerous using IRR can be.
|
|
|
|