View Single Post
  #3   Report Post  
Rowan Drummond
 
Posts: n/a
Default How do I insert a PictureBox into Excel?

This will place the picture on the sheet at the currently selected cell.

Sub JPeg()
Dim flname As Variant
flname = Application.GetOpenFilename
If flname < False Then
If Right(flname, 3) = "jpg" Then
ActiveSheet.Pictures.Insert (flname)
Else
MsgBox "That is not a jpeg file"
End If
End If
End Sub

Hope this helps
Rowan

Evanbron wrote:
I don't know much about VBA. Is there any way to easily insert a PictureBox
into an Excel worksheet so that a .jpg file can be selected from a directory
of .jpg files and loaded to the worksheet?

Thanks,

Evanbron