Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use XIRR FUNCTION IN A VB 2005 PROGRAM
I'm getting RPC error when I try to register analys32.xll in the VB program.
ErrorCode=-2147417851 Message="El servidor lanzó una excepción. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))" Source="Microsoft.Office.Interop.Excel" StackTrace: at Microsoft.Office.Interop.Excel.ApplicationClass.Re gisterXLL(String Filename) at WindowsApplication9.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\ccuervo\Mis documentos\Visual Studio 2005\Projects\WindowsApplication9\WindowsApplicati on9\Form1.vb:line 9 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationCo ntext context) at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine) at WindowsApplication9.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context( Object state) at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() The code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objExcel As Microsoft.Office.Interop.Excel.Application objExcel = New Microsoft.Office.Interop.Excel.Application objExcel.Workbooks.Open(objExcel.Application.Libra ryPath & _ "\Análisis\atpvbaen.XLa") objExcel.RegisterXLL(objExcel.Application.LibraryP ath & _ "\Análisis\analys32.xll") Dim p(4) As Double p(0) = -4504000.0 p(1) = 66183.78 p(2) = 86326.67 p(3) = 86326.67 p(4) = 4524142.89 Dim X As Double ' objExcel.AddIns.Add("c:\Analisis\atpvbaen.XLa") Dim d(4) As Date d(0) = #1/1/1998# d(1) = #3/1/1998# d(2) = #10/30/1998# d(3) = #2/15/1999# d(4) = #4/1/1999# Debug.Print(objExcel.Run("xIrr", p, d)) ' Result: 0.374858599901199 'objExcel.A() 'MsgBox(X) objExcel.Quit() objExcel = Nothing End Sub Anyone of you know how to solve this problem |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
XIRR FUNCTION | Excel Worksheet Functions | |||
Please help for FV and XIRR function. | Excel Worksheet Functions | |||
xirr function | Excel Worksheet Functions | |||
Using XIRR function in VBA ? | Excel Programming | |||
XIRR function | Excel Worksheet Functions |