Wil Moosa
Well-known Member
- Joined
- Aug 11, 2002
- Messages
- 893
The following code works but 1) the resolution of the pic is not at it's best ánd 2) width and height are disformed. I tried a bit but it only got worse. Any suggestions to improve the code? Thank you.
VBA Code:
Sub ExportDiagrammenFT()
Const FName As String = "C:\Test\TestImage.jpg"
Dim pic_rng As Range
Dim ShTemp As Worksheet
Dim ChTemp As Chart
Dim PicTemp As Picture
Application.ScreenUpdating = False
Set pic_rng = Worksheets("Grafieken_FT").Range("C1:O79")
Set ShTemp = Worksheets.Add
Charts.Add
ActiveChart.Location Where:=xlLocationAsObject, Name:=ShTemp.Name
Set ChTemp = ActiveChart
pic_rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
ChTemp.Paste
Set PicTemp = Selection
With ChTemp.Parent
.Width = PicTemp.Width + 8
.Height = PicTemp.Height + 8
End With
ChTemp.Export Filename:="C:\Test\Functiemix VH " & _
Format(Date, "dd-mm-yyyy") & ".jpg", FilterName:="jpg"
Application.DisplayAlerts = False
ShTemp.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub