I am trying to generate excel in ax 2009(Chinese version). I have created a form and use the menuItemButton to call the class to generate the excel.
It works fine when generating the excel without open then close other folders/word Pad... and close it
But when generating the excel and open then close other folders/word Pad, it will flow error ("类“Range”的 COM 对象中的方法“value”返回了错误代码 0x800A03EC (<未知>)，此错误代码表示: <未知>。"/ "执行代码时出错。: 变量赋值中的参数类型错误。" / "提供的参数数目与该方法接受的参数数目不同。")
Does anybody also try this error before?
Which version of AX 2009 are you trying? Just a suggestion, had you tried to look into the kernel rollup hotfixes release?
you can find the hotfix release information in PartnerSource
I am the newer in AX2009..... I only can get this information
In about Microsoft Dynamics AX
Microsoft Dynamics AX2009
Kernel version: 5.0.1600.1824
Application version: 5.0.1000.52
I have tried just while loop to print 1000 rows and do the open/close step, it also show error
It's a well-known issue in AX2009/2012: in case COM integration happens in the client's UI thread and involves an external COM-server, the kernel enforces a timeout for each COM object call, and in case you start switching to other processes' windows (which lowers AX client process priority) or do anything similar that can increase AX client's response time, a COM call can yield an arbitrary error like one of yours. There are some ugly patches in the standard Excel export code (see \Classes\SysGridExportToExcel\performPushAndFormatting) that use try/catch/retry for COM calls, and to some extend this approach well... works. Other options: run Excel export in a separate thread; use .NET Office integration instead of COM (which in fact is just a wrapper for COM integration, but AX kernel doesn't enforce any kind of timeouts in case of CLR interop).
Thank you for gl00mie and Tony Wan reply!
The problem seems gl00mie said....
I am now using Thread to generate the excel. It seems work.
Thank you all of you.