Copying Image to Clipboard

teguh123

BANNED
Joined
Sep 23, 2008
Messages
703
Reaction score
106
Hi,

if I have a htmlimg object and I want to copy that to clipboard or to file how do I do that?

This is my code

Code:
Public Function imgToFile(img As HTMLImg) As String
    Dim ocr As IHTMLControlRange
    Dim theFile As String
    
    theFile = trim(CStr((GetTickCount Mod 100000))) + ".jpg"
    
    
    Set ocr = img.Document.body.createControlRange
    Clipboard.Clear
    ocr.Add img
    ocr.execCommand "Copy"
    Call SavePicture(Clipboard.GetData(ClipBoardConstants.vbCFBitmap), theFile)
    imgToFile = theFile
End Function
 
Back
Top