Function CreateIpictureCopyBitMapToClip(obj As Object)
Dim IPic As IPicture, hCopy&, tIID As GUID, PictStructure As PICTDESC, x#, Ret&
Call OpenClipboard(0): EmptyClipboard: CloseClipboard
obj.CopyPicture Format:=xlBitmap
OpenClipboard 0&
x = Timer
Do While (hCopy = 0)
hCopy = CopyImage(GetClipboardData(&H2), 0, 0, 0, &H8)
If Timer - x > 1 Then Exit Do
Loop
CloseClipboard
If hCopy = 0 Then Set CreateIpictureCopyBitMapToClip = IPic: Exit Function
Const IPictureIID = "{7BF80981-BF32-101A-8BBB-00AA00300CAB}"
Ret = IIDFromString(StrConv(IPictureIID, vbUnicode), tIID)
If Ret Then Set CreateIpictureCopyBitMapToClip = IPic: Exit Function
With PictStructure: .cbSize = Len(PictStructure): .picType = 1: .himage = hCopy: End With
Ret = OleCreatePictureIndirect(PictStructure, tIID, 1, IPic)
If Ret Then Set CreateIpictureCopyBitMapToClip = IPic: Exit Function
Set CreateIpictureCopyBitMapToClip = IPic
Call OpenClipboard(0): EmptyClipboard: CloseClipboard
End Function