disable inserting OLE objects into word by paste or darg & drop

A

adi

hi,
i need to prevent the user from inserting ole object into a document.
if the user is trying to had ole object by paste or drag & drop i want to
raise an event, check the object type and decide if it can be inserted to the
doc. is it possible?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?YWRp?=,
i need to prevent the user from inserting ole object into a document.
if the user is trying to had ole object by paste or drag & drop i want to
raise an event, check the object type and decide if it can be inserted to the
doc. is it possible?
Not really, no. The closest event Word has that MIGHT trigger reliably on this
is WindowSelectionChange. That should return SEL. And *maybe*, if you're lucky,
the Sel.Type would tell you it's an OLE object. But there'd be no way to
determine whether it came in via drag-and-drop.

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 :)
 
A

adi

maybe it will work... i'll try that
thanks a lot

Cindy M -WordMVP- said:
Hi =?Utf-8?B?YWRp?=,

Not really, no. The closest event Word has that MIGHT trigger reliably on this
is WindowSelectionChange. That should return SEL. And *maybe*, if you're lucky,
the Sel.Type would tell you it's an OLE object. But there'd be no way to
determine whether it came in via drag-and-drop.

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


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

adi

i've tried the WindowSelectionChange event. when an image or any object is
pasted to the doc it returns wdSelectionIP and i didnt manage to get the
pasted object type from this information. when an object is draged to the
document it doesnt fire the event at all.
pressing the added object does return wdSelectionInlineShape but that isnt
helping...
have any idea how to make it work?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?YWRp?=,
i've tried the WindowSelectionChange event. when an image or any object is
pasted to the doc it returns wdSelectionIP and i didnt manage to get the
pasted object type from this information. when an object is draged to the
document it doesnt fire the event at all.
pressing the added object does return wdSelectionInlineShape but that isnt
helping...
have any idea how to make it work?
In that case, no, none :-( I've seen a discussion or two in one of the
office.developer newsgroups that revolved around drag-and-drop and getting
some kind of control (not your problem, exactly). But the results were mostly
not positive.

The "last resort" in Word for things that can't be controlled is to check the
document for "whatever-it-is" prior to doing something like allowing a save,
or printing.

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 :)
 
A

adi

yep... my only solution now is checking the doc before saving, go over all
the inlineshapes, check their type and erase those that not allowed from the
code :/
 

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