Re: Cutting and pasting images from Safari to Word
- From: "John McGhie [MVP - Word and Word Macintosh]" <john@xxxxxxxxxxx>
- Date: Mon, 30 Jan 2006 23:59:40 +1100
Hi Alex:
For the reasons others have mentioned, this is not an easy problem to solve.
Here's the macro:
Sub PastePicture()
'
' Macro recorded 30 January 2006 by John McGhie
' Attempts to paste the content of the clipboard as a picture
Selection.Range.PasteSpecial DataType:=wdPasteMetafilePicture
End Sub
Considerations:
Everything you have heard to date about the toxicity of VBA when dealing
with the clipboard is all true :-) This is not just limited to VBA 5 -- no
version of VBA will allow you to find out IN ADVANCE what data types are
available on the clipboard.
Worse: if you ask for one that is NOT available, VBA blows up on an error in
the 5,000 range. Sadly, error numbers above 4,999 are generated by Word,
not VBA, so you cannot trap them with an error handler. The code will
always fail, the error message will always appear, and there's nothing you
can do about it.
By trial and error (!) I determined that in OS 10.3.9, Safari 1.3.2 appears
to be placing on the clipboard a data type that Word can paste as a
metafile. That is effectively what Edit>Paste Special>Picture does from the
user interface. "Picture" means a metafile format capable of containing a
mixture of anything you like -- either a raster or a vector graphic, or
text or drawing objects.
In Windows, this would be encapsulated in the document as a WMF metafile
unless the source uses a colour table greater than 256 colours, in which
case it would use EMF (32-bit) format. I suspect that Mac Word uses a PICT
metafile, but I don't have the tools here to dig around in the document to
find out what is actually in there.
The bottom line is that you can paste any graphics format as a metafile and
leave it to Word and OS X to cooperate on what the thing actually contains.
The problem we have here is that if you do not have anything on the
clipboard that will paste as a picture, you will see a nasty (albeit
self-explanatory) error message, and there's nothing I can do about that --
it's one of the untrappable series of errors.
Hope this helps
On 30/1/06 5:26 AM, in article C0027322.12F%aaisen@xxxxxxxxx, "Alex Aisen"
<aaisen@xxxxxxxxx> wrote:
> I'm new with a Mac.
>
> I am trying to do something simple - copy an image from Google images
> (viewed via Safari) to MS Word for the Mac 2004. If I copy the image and
> then paste it in Word, the system pastes the HTML link to the image, not the
> image itself.
>
> If instead of using paste (i.e., command-V), I choose paste special from the
> edit menu, and manually click on paste as "picture" rather than the default
> paste as "unformated text" it works, and pastes the image.
>
> Since I do this a lot, any way I can make the paste command paste the
> picture itself, rather than the html link? I would think this would be the
> default setting, but apparently it isn't.
>
> I have a new iMac with the Pentium dual core processors, Mac OX 10.4.4 and
> all available updates to the OS and Word installed.
>
> Thanks!
>
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <john@xxxxxxxxxxx>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
.
- Follow-Ups:
- Re: Cutting and pasting images from Safari to Word
- From: Paul Berkowitz
- Re: Cutting and pasting images from Safari to Word
- References:
- Cutting and pasting images from Safari to Word
- From: Alex Aisen
- Cutting and pasting images from Safari to Word
- Prev by Date: Re: Changing a large number of styles
- Next by Date: Re: How to Make Tabbing work from VBA
- Previous by thread: Re: Cutting and pasting images from Safari to Word
- Next by thread: Re: Cutting and pasting images from Safari to Word
- Index(es):
Relevant Pages
|