Paste a copied image into a Picture Box?

bob12321

New Member
Joined
Aug 22, 2013
Messages
13
Hi all, I'm trying to create a situation where when someone clicks on an image box, it pastes their clipboard image into the imagebox. The image is found online.

Unfortunately, I have no idea how this is possible.

After much googling, i came across the "Pastepicture.xls" item made in 2000, but I was wondering whether there is a simpler method of achieving this.

I don't actually understand what the pastepicture code is actually doing - it is referencing a chart and saving as a gif. which I do not want.

Basically, when the user pastes the picture in, there will be an option to overwrite the existing picture with this new one.

Thanks for any suggestions/help
 
Have you tried Stephen Bullen's PastePicture code here: http://www.oaltd.co.uk/DLCount/DLCount.asp?file=PastePicture.zip

I have and I have inserted the module with the following code:

Code:
Private Sub Image1_Click()Dim response As Integer
response = MsgBox("Update Image with Image in Clipboard?", vbOKCancel, "Update Image?")
If response = vbOK Then
Dim lPicType As Long
lPicType = IIf(obMetafile, xlPicture, xlBitmap)
Image1.Picture = PastePicture(lPicType)
updated = True
End If
End Sub

However, two issues: the image doesn't actually paste and I would like to save the image in the future as a jpg - is that possible?

Thanks RoryA (Again :P )
 
Upvote 0
What kind of picture are you copying?

To save the file in its current format you can use something like:
Code:
SavePicture Image1.Picture, "c:\some pic.bmp"
 
Upvote 0
What kind of picture are you copying?

To save the file in its current format you can use something like:
Code:
SavePicture Image1.Picture, "c:\some pic.bmp"

Oh thanks for that, I'll use that when I get this sorted! Well its a jpg image that I copied from the internet. Ideally, I would like to press a button and it updates with this image in the imagebox (pasted from the clipboard). I tried using the Pastepicture thing but it just doesn't paste anything...
 
Upvote 0
I think as it is, PastePicture only understands bitmaps and excel pictures. Perhaps you should use the code that pastes to a chart and then exports it. That would take care of the file saving part too.
 
Upvote 0
:O That just sounds complicated!

Okay, a compromise: is there anyway of loading an image in a url in the clipboard in an imagebox?
 
Upvote 0
Manage to just work around this as suggested: I downloaded and saved the image temporarily - and loaded it into the picturebox!
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top