Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nickolai Medveditskov - 22 Mar 2006 16:12 GMT
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
Cindy M  -WordMVP- - 11 Apr 2006 09:26 GMT
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
:-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.