MS Project Delete Custom Fields Dialog Opening After Running Code

328 Views Asked by At

I have tool that's part of a VSTO add-in for MS Project that clears data out of an MS Project file that the user chooses. It uses methods such as Application.CustomFieldDelete(), Application.CustomFieldPropertiesEx(), Application.BaselineClear(), Application.SetTaskFieldByID(), ActiveProject.Views[x].Delete(), ActiveProject.TaskTables[x].Delete(), Task.SetField() etc...

Sanitizer

After the tool runs, when I try to insert a column in the Gantt Table, MS Project opens this dialog:

Delete Custom Fields Dialog

Project forces me to delete a text field to insert any column even though, as you can see, not every text field has a custom name applied. In fact, after I run the tool with the setup from the above image, only 4 Text fields have a custom name still applied, the rest get the Application.CustomFieldDelete() method done to them.

I've had this problem occur in the past with VBA macros I had created, but I was never sure what exactly caused it. What would cause Project to do this, and how can I avoid it?

0

There are 0 best solutions below