Yaron Kohavi


Hi,

When I record a macro which emulates the following menu selection: Edit, Paste Special, Device independent bitmap, I get the following code:

Sub Macro2()

'

' Macro2 Macro

' Macro recorded t12/03/2007 by yaronk

'

Selection.PasteAndFormat (wdPasteDefault)

End Sub

Sub PasteInde

Where in fact, it seems as if the code should have been:

Sub PasteIndepenent()

Selection.PasteSpecial DataType:=wdPasteDeviceIndependentBitmap

End Sub

Can anyone explain me the logic behind the recorded code

I would greatly appreciate any insight on this matter.




Re: Strange recoeded code for pasting device independent bitmap

sjoo


Hi,

You're working on Word. Your post is interesting!!!. I've tried as your code.

My recorded code is the same with you.

When running with a small picture, the two code(recorded code & your code) are not different.

But in case of a large picture(alse has many colors), your code doesnot paste it well.

The count of color become decreased.

However I dont know the logic behind the code.

Best regards.

sjoo






Re: Strange recoeded code for pasting device independent bitmap

skipper75

Have a look at:

http://msdn2.microsoft.com/en-us/library/bb241758.aspx

.PasteSpecial(IconIndex, Link, Placement, DisplayAsIcon, DataType, IconFileName, IconLabel)

DataType:





Re: Strange recoeded code for pasting device independent bitmap

Jon Peltier

wdPasteDefault = 0, so it mimics pasting an OLE object, but I suspect it's almost like wdPasteAutomatic (which I just made up). The point is, though, that the macro recorder records a bunch of code, not necessarily the most efficient. Take what the recorder gives you, and make it better. If you want to paste a DIB, use wdPasteDeviceIndependentBitmap.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______