I’m working on a project where the user can insert data into a document using fields, document properties and variables. The user also needs to be able to remove the data from the document. So far, I’ve managed to remove the document property and variable, but I’m not sure how I would go about removing the field (that’s already inserted into the document). Note that I need to compare the field to a string, and if it matches; delete it from the doc.
Share
I’m assuming you’re using .NET Interop with Word. In that case, I believe you’re looking for
Field.Delete.This is of course also assuming you know how to get the field you’re looking for, which would usually be enumerating through
_Document.Fields(or a more finite range if you know one) until you get the right one.