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 ' 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" ' 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. 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. I'm using 64bit office in 64bit window 10 PC
0 Comments
Leave a Reply. |