COMException caused by Application.EditClear Method

0

I have a COMException caused by the following code

MSProject.Application mspApp;
bool result = mspApp.SelectColumn(Constants.ACTUALS_RECENT_INDEX, Missing.Value, Missing.Value, Missing.Value);
mspApp.EditClear(Missing.Value, Missing.Value, Missing.Value, Missing.Value);

The value of result is true.

Here's the exception:

System.Runtime.InteropServices.COMException (0x000003EC): An unexpected error occurred with the method.

at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)

at Microsoft.Office.Interop.MSProject._MSProject.EditClear(Object Contents, Object Formats, Object Notes, Object Hyperlinks)

Anybody knows the cause of this exception?

ms-project
asked on Stack Overflow Dec 24, 2013 by Fengdan Lu • edited Jun 20, 2020 by Community

2 Answers

0

It sounds like the column that is getting selected is a read-only field such as ID, Unique ID, Project, etc.

Make sure the column being selected is the one you really want. You could do this by creating a table at run-time (and apply it) so you can be confident that the user has not changed the active view and/or underlying table.

answered on Stack Overflow Jan 8, 2014 by Rachel Hettinger
0

The root cause is that a customized filter is applied while calling EditClear function. This filter will result in no data in the table. The issue disappeared if not applying the filter.

answered on Stack Overflow Jan 29, 2014 by Fengdan Lu

User contributions licensed under CC BY-SA 3.0