My object has a property that refers to a Comment object in a VSTO application.
I see that this reference refers to the comment as it was at the point in time that I instantiated it. So, if a user edits the comment in Word, then the Comment object does not reflect the change, and is in fact no longer associated with the Comment it referred to.
Is there a way of keeping the VSTO comment object pointing to the same comment in Word after the comment is changed?
Edit: Preliminary experimentation with the approach here: https://badecho.com/2010/09/outlook-com-interop-and-reference-equality-for-unique-runtime-callable-wrapper-objects/
looks like it does what I need... I will close this if this proves to be the case.
You can handle the Application.DocumentChange event and retrieve the required commend anew without keeping an old object. Use Comments(Index)
, where Index
is the index number, to return a single Comment
object. The index number represents the position of the comment in the specified selection, range, or document.