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!

Exporting images Excel VBA

Status
Not open for further replies.

MedievalMan

Technical User
Mar 13, 2008
2
CA

Currently I am exporting an image (since export is only available with charts) by copying the image and placing it in a chart and exporting from there:

(btw, I'm doing this so I can save a local copy to use with the header logos)

Code:

Code:
Dim objPict As Object
Dim MyChart As Chart

Sheets("Test Header").Shapes("logo").Select
Set objPict = Selection
    
With objPict
    .CopyPicture 1, 1
    Set MyChart = ActiveSheet.ChartObjects.Add(1, 1, .Width, .Height).Chart
End With
    
With MyChart
     .Paste
     .Export Filename:="C:\logo.gif", FilterName:="gif"
     .Parent.Delete
End With

My problem is that the generated image logo.gif always has a grey border around it -- is there anyway to disable this? It happens irregardless if I use the gif, jpg, or tiff filter.

Or, alternately, is there a better way of exporting images?


Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top