save picture in a worksheet programmatically


G

Guest

Hi,
i searched queries up to now and could not find anything about saving a
picture in a normal worksheet(not a chart) to a local directory as a gif/jpg
file programmatically.
please, can anybody help me?
 
Ad

Advertisements

G

Guest

why is it easy to insert a picture into worksheet but no way to save the same
picture
in a file directory?
i am sure there are people facing the same problem as i do. is there any way
to save the picture programmatically?
can anybody please help me?

thanks,
 
G

Guest

ANDY THANKS,
how do i create chart programmatically?
how do i put a picture into that chart programmatically?
how do i then save it?
i visited the link and downloaded the code but could not understand anything
from that code. can you please explain it in a more simple code please?

thanks again,
 
Ad

Advertisements

A

Andy Pope

Try this, although you will still need to specify which shape and output
filename.

Sub ShapeExport()

Dim objCht As ChartObject
Dim shpTemp As Shape

' reference the thing you want to export
Set shpTemp = ActiveSheet.Shapes(1)

With ActiveSheet.ChartObjects.Add(1, 1, 10, 10)
.Width = shpTemp.Width + 2
.Height = shpTemp.Height + 2
shpTemp.Copy
With .Chart
.Paste
With .ChartArea
With .Border
.Weight = 2
.LineStyle = 0
End With
.Interior.ColorIndex = xlNone
End With
' filename and folder
.Export "C:\MyImage.gif"
End With
.Delete
End With
End Sub

Cheers
Andy
 

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