How to invoke Excel's financial function IRR (original) function (original) function with the OLE

xiaoxiao2021-03-06  36

OleObject ExcelServerinteger Li_okdec {2} ld_retlong ll_arr []

ExcelServer = Create oleObjectli_ok = ExcelServer.connectToObject ("Excel.Application")

if Li_ok <0 Then Li_ok = ExcelServer.ConnecttonewObject ("Excel.Application") if Li_ok <0 Then MessageBox ("Tips", "Your computer may not install, so you can't export!") Return End IFend IF

LL_ARR [1] = -70000LL_ARR [2] = 12000LL_ARR [3] = 15000

ExcelServer.visible = false ld_ret = ExcelServer.WorksheetFunction.irr (ll_arr, -0.1) ExcelServer.quit () ExcelServer.disconnectObject () Destroy ExcelServer

MessageBox ("Internal Investment Revenue Rate is:", String (LD_RET)) // wherein the LL_ARR array is used to store parameters of the IRR function, can modify the setting // ll_arr [1] = -70000 // ll_arr [2] = 12000 // ll_arr [3] = 15000 // - 0.1

// These are all the example data of the IRR function in Excel comes with the IRR function, which can be known as the help

转载请注明原文地址:https://www.9cbs.com/read-72906.html

New Post(0)