Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XIRR FUNCTION Lynndale Excel Worksheet Functions 6 July 11th 08 12:03 AM
Please help for FV and XIRR function. RushatiINDIA Excel Worksheet Functions 3 April 12th 07 04:00 AM
xirr function john Excel Worksheet Functions 1 June 23rd 06 04:10 AM
Using XIRR function in VBA ? martonec Excel Programming 1 March 20th 06 10:13 PM
XIRR function Daniel Bonallack Excel Worksheet Functions 2 June 20th 05 09:00 PM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"