Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put an image(picture) in excel using vb code

Status
Not open for further replies.

GORAVENS

MIS
Mar 11, 2003
4
US
Let's say I have a picture of myself in c:\my pics\me.jpg and I want to put it in B4. Can Anyone help.

I tried
shtEXCEL.Cells(2, 4) = LoadPicture("c:\my pics\me.jpg")

with no luck.
 
Sub MacroNN()
'example from VBA HELP file

'AddPicture Method Example

'This example adds a picture created
'from the file Music.bmp to myDocument.
'The inserted picture is linked to the file
'from which it was created and is saved with myDocument.
Dim myDocument
Dim c As Range

Set myDocument = Worksheets(1)
myDocument.Shapes.AddPicture _
"C:\Documents and Settings\andy\My Documents\My Pictures\CheckBox.bmp", _
True, True, 100, 100, 70, 70

'insert picture in B2 top-left corner
Set c = Worksheets(1).Range("B2")
myDocument.Shapes.AddPicture _
"C:\Documents and Settings\andy\My Documents\My Pictures\CheckBox.bmp", _
True, True, c.Left, c.Top, 50, 50
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top