How to Insert Picture in Excel?

S

Spike

Hi friends!

I need your help on this VBA code, please!

on the Excel worksheet, I have one "Image1" and "CommandButton1".

at run time, when the user click on the "CommandButton1"(for inserting
a picture), a small window popup with filter(.jpg, .bmp, .tif, etc.) so
that the user can select a picture and click "Insert" button from this
window and that picture will be inserted inside the "Image1" on the
ExcelSheet

Hopefully you can help me out this VBA code!
thanks!

Spike.
 
D

Dave Peterson

How about:

Option Explicit
Private Sub CommandButton1_Click()

Dim myPictName As Variant

myPictName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")
If myPictName = False Then
Exit Sub
End If

Me.Image1.Picture = LoadPicture(myPictName)

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top