How to Insert Picture in Excel?

  • Thread starter Thread starter Spike
  • Start date Start date
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.
 
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
 
Back
Top