I've following problem:

I have a COM AddIn for Word, developped in VB .NET. Within this AddIn some documents can be opened. To those documents the menu "Save as" (in Word) shall be disabled. For the other documents it should be enabled.

This is how I do it:
VB Code:
  1. Dim objWord As Word.Application
  2. objWord = CType(objWordInstance, Word.Application)
  3. objWord.CustomizationContext = objWord.ActiveDocument
  4. objWord.CommandBars(cstrMenuBar).Controls(cstrMenuDatei).controls(cstrMenuSaveAs).enabled = False

That's working fine.

Now I want to save and close this document. (It's saved automatically when the user closes it; therefore I'm using the DocumentBeforeClose event). During this procedure I am sometimes asked, if I want to save the document.

Just in the beginning of my DocumentBeforeClose I set the enabled-property to true again.

Any idea what may be wrong?