Can't exit design mode because Control 'MyTextBoxXXX' can not be created

  • Thread starter Nickolai Medveditskov
  • Start date
N

Nickolai Medveditskov

Hi,

I am hosting MS Word in my ActiveX written in C++ unmanaged code.
This ActiveX manipulates document content via Automation.
It inserts the OLE controls into document using the following code:

[pseudocode]
ActiveDocument.InlineShapes.AddOLEControl("MyWordWrapper.MyTextBox")
[/pseudocode]

When the Word's Macro Security is set to High everything is OK - the control
is inserted without any problems.
When the security level is set to Low, Word produces message box:

=======================
Can't exit design mode because Control 'MyTextBoxXXX' can not be created
=======================

where the "XXX" is some ordinal. Nevertheless the control is correctly inserted
with name "MyTextBoxYYY" where "YYY" is
an ordinal that's different from "XXX". At the moment of insertion NO other
controls of type "MyWordWrapper.MyTextBox" are present
in the document BUT the control with the same name ('MyTextBoxXXX') might
have existed in this document before.

My questions are:

1. How I can eliminate this warning in Low Security Mode?
NOTE: - I cannot change the Macro Security Level.
- I receive the Word document from third party and can manipulate it ONLY
via automation.
2. What's the cause of this warning?


Thanks.

Nickolai
 
C

Cindy M -WordMVP-

Hi Nickolai,
1. How I can eliminate this warning in Low Security Mode?
NOTE: - I cannot change the Macro Security Level.
If the version of Word is 2002 or 2003 you can try setting
the Application.AutomationSecurity property before opening
the file. This sets the security level only for the duration
of your code, not at the user level.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun
8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top