 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Marcin Junger Guest
|
Posted: Thu Sep 21, 2006 1:55 pm Post subject: Word - CustiomizationContext |
|
|
Hello everyone,
I have another problem with Outlook using Word as editor. I create a
button on a Standard command bar. If Outlook does not use word,
everything works fine - the "temporary" parameter works and buttons are
not "remembered" after closing an inspector.
To do the same with word i am trying to:
1)save current customization context;
2)change customization context to current document;
3)do what I have to do;
4)restore customization context so changes made by user are permanent;
Sounds easy.
Here is my code from OnNewInspector event:
var
idWordEditor : Word97._Document;
idsCustomization : IDispatch;
(...)
//save current customization context and set it to current document
if Inspector.IsWordMail then begin
idWordEditor := IDispatch(Inspector.WordEditor) as _Document;
try
//the next line SOMETIMES raises an exception
idsCustomization := idWordEditor.Application.CustomizationContext;
except
idsCustomization := idWordEditor.Application.NormalTemplate;
end;
idWordEditor.Application.CustomizationContext := idWordEditor;
end;
try
(...)create button(...)
finally
//restore customization context
if Inspector.IsWordMail then begin
idWordEditor.Application.CustomizationContext := idsCustomization;
end;
end;
Apart from fact, that reading idsCustomization sometimes raises
exception, restoring it doesn't work. The code is executed and still in
View->Toolbars->Customize Save In=Untitled Message. If I don't change
the context by disabling idWordEditor.Application.CustomizationContext
:= idWordEditor; it is Normal.dot.
What do I do wrong?
Marcin |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|