CustomizationContext

Heike

Well-known member
Joined
Jun 5, 2002
Messages
56
Ive 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:
Code:
Dim objWord As Word.Application
objWord = CType(objWordInstance, Word.Application)
objWord.CustomizationContext = objWord.ActiveDocument
objWord.CommandBars(cstrMenuBar).Controls(cstrMenuDatei).controls(cstrMenuSaveAs).enabled = False

Thats working fine.

Now I want to save and close this document. (Its saved automatically when the user closes it; therefore Im 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?
 
Back
Top