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 / September 2006

Tip: Looking for answers? Try searching our database.

Disable paste for images

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarkN - 27 Sep 2006 04:24 GMT
Hello,

I am regularly sent massive Word documents where images have been pasted
into the document. Is it possible to disable the paste command if someone
tries to paste an image?
Signature

Thanks in advance,
MarkN

Jezebel - 27 Sep 2006 05:01 GMT
If you write a macro called EditPaste it will run in place of the built-in
command. However it's not so easy to check what's in the clipboard, to
distinguish between pasting text and pasting images: you'll need to read up
on the API calls for the purpose. Or write a VB function (as opposed to
VBA) - VB has access to the ClipBoard object.

In any case, how will this help you with documents that already contain
images?

> Hello,
>
> I am regularly sent massive Word documents where images have been pasted
> into the document. Is it possible to disable the paste command if someone
> tries to paste an image?
MarkN - 27 Sep 2006 05:18 GMT
Thanks for getting back to me,

I am not really VBA (or VB) literate but can 'hack' with the best of them. I
just like to know something is possible before I start.

To answer your question, this will not help me with existing documents, but
most of these documents are produced using a selection of templates. I was
thinking that if I added a macro to the templates that stopped the paste
command from working when an image was to be pasted and also included a
message box "paste won't work, use Insert Picture" then future problems would
be solved.

Does that sound like it might work?
Signature

Thanks again,
MarkN

> If you write a macro called EditPaste it will run in place of the built-in
> command. However it's not so easy to check what's in the clipboard, to
[quoted text clipped - 10 lines]
> > into the document. Is it possible to disable the paste command if someone
> > tries to paste an image?
Jezebel - 27 Sep 2006 06:04 GMT
I'm not sure what you see as the difference between a picture pasted from
the clipboard as opposed to one inserted using Insert > Picture. If the
copied picture is a simple graphic, the result is the same either way.
Unless you have in mind that the pictures should be linked rather than
embedded? Or are you trying to prevent the pictures being inserted as
objects (ie with all the baggage of an embedded application)?

Whatever, intercepting the Paste command and trying to work out what the
user is doing is tricky. You could intercept EditPaste, count the number of
pictures in the document, let them paste whatever they want, then check if
the number of pictures has gone up. If so, Undo, and display your message.

Another approach would be to check the document when it is saved: "This
document has too many pictures.... please fix".

However, I would recommend against all of this. The effort of trying to
support code running on other people's computers, plus fielding their calls
when things go wrong (and believe me, you'll get blamed for *everything* ...
"my computer's been totally stuffed since Mark installed that f*g macro...")
will almost certainly be more than dealing with obese documents.

> Thanks for getting back to me,
>
[quoted text clipped - 31 lines]
>> > someone
>> > tries to paste an image?
MarkN - 27 Sep 2006 06:23 GMT
Advice taken, thanks for your time.
Signature

Cheers,
MarkN

> I'm not sure what you see as the difference between a picture pasted from
> the clipboard as opposed to one inserted using Insert > Picture. If the
[quoted text clipped - 52 lines]
> >> > someone
> >> > tries to paste an image?

Rate this thread:






 
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.