

- #SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE MANUAL#
- #SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE REGISTRATION#
- #SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE CODE#
- #SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE PC#
'Make a local copy, in case the clipboard is changed LPictureAvailable = IsClipboardFormatAvailable(lMETAFILE) 'Check if the clipboard contains a picture file 'For test it, do not forget to copy manually your picture. Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32.dll" (PicDesc As uPicDesc, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long 'Convert the handle into an OLE IPicture interface. Private Declare PtrSafe Function CloseClipboard Lib "user32" () As Long Private Declare PtrSafe Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA" (ByVal hemfSrc As Long, ByVal lpszFile As String) As Long Private Declare PtrSafe Function GetClipboardData Lib "user32" (ByVal wFormat As Integer) As Long Private Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long Private Declare PtrSafe Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Integer) As Long 'Does the clipboard contain a Metafile Picture? 'Declare a Type to store the image information 'Declare a Type to store a GUID for the IPicture OLE Interface 'Requires a reference to the "OLE Automation" type library Unique required change was OleCreatePictureIndirect Lib, from ""olepro32.dll" to "oleaut32.dll"Īnd it worked. (Sorry, I not yet authorized to post a link, I'm new here) R = OleCreatePictureIndirect(uPicInfo, IID_IDispatch, 1, IPic) hPal = IIf(lPicType = CF_BITMAP, hPal, 0) Type = IIf(lPicType = CF_BITMAP, PICTYPE_BITMAP, PICTYPE_ENHMETAFILE) Public Function CreatePictureVBA7(ByVal hPic As LongPtr, ByVal hPal As LongPtr, ByVal lPicType) As IPictureĭim r As Long, uPicInfo As uPicDesc, IID_IDispatch As GUID, IPic As IPicture If hPtr 0^ Then Set PastePictureVBA7 = CreatePictureVBA7(hCopy, 0, lPicType) HCopy = CopyEnhMetaFile(hPtr, vbNullString) HCopy = CopyImage(hPtr, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG) HPicAvail = IsClipboardFormatAvailable(lPicType) LPicType = IIf(lXlPicType = xlBitmap, CF_BITMAP, CF_ENHMETAFILE) Public Function PastePictureVBA7(Optional lXlPicType As Long = xlPicture) As IPictureĭim H As Long, hPicAvail As Long, hPtr As LongPtr, hPal As LongPtr, lPicType As Long, hCopy As LongPtr ''Correct lPicType type is integer or long? Public Function PastePicture(Optional lXlPicType As Long = xlPicture) As IPicture

Public Declare PtrSafe Function CopyImage Lib "user32" (ByVal Handle As LongPtr, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As LongPtr Public Declare PtrSafe Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA" (ByVal hemfSrc As LongPtr, ByVal lpszFile As String) As LongPtr
#SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE REGISTRATION#
' I already did regsvr32 registration and succeeeded but function still not working. ' Or can I use regsvr32 oleaut32.dll command in cmd window instead ? ' "Can't add a reference to the specified file"
#SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE MANUAL#
' In here, I tried manual referencing via tools > reference but can't, the error says Public Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32.dll" (PicDesc As uPicDesc, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long Public Declare PtrSafe Function CloseClipboard Lib "user32" () As Long Public Declare PtrSafe Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As LongPtr 'Correct wFormat type is integer or long? Public Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hwnd As LongPtr) As Long Public Declare PtrSafe Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Long) As Long I'll appreciated it if anybody can give me a simple clue.
#SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE CODE#
I changed a little code and simplified it and below is the final one. So I used regsvr32 C:\windows\system32 oleaut32.dll in administrator mode and now succeeded but still can't get clipboard image to userform. I did googling and found below sample code to load picture from current clipboard to userformīut not working !!! Firstly I doubt about the dll referencing because I can't manually add reference using tools > reference command in VBE.
#SUBSCRIBE FACEBOOKTWITTERURL COPYIMAGE PC#
The function performs a non-temporal store (the data is written to memory directly without polluting the cache).I'm using 64bit office in 64bit window 10 PC This function is optimized if the MMX, SSE, or SSE2 instruction sets are available on the processor. In this case, pDest and pSrc must point to the start of each plane. For planar YUV formats, you must call the function once for each plane. This function copies a single plane of the image. Otherwise, it returns an HRESULT error code. If this function succeeds, it returns S_OK. Pointer to the start of the first row of pixels in the source image. Stride of the destination buffer, in bytes. Pointer to the start of the first row of pixels in the destination buffer. Copies an image or image plane from one buffer to another.
