Sub Export_Ako_PNG()
Dim List As Object, Graf As Object
Dim NazObr As String, NazList As String
Dim ObrH As Single, ObrW As Single
Dim Cesta As String, Nazov As String
Application.ScreenUpdating = False
NazList = "CELKEM"
Set List = Sheets(NazList)
With List
.Select
Nazov = .Range("A1").Text & ".PNG" 'nazov obrazku
Cesta = .Range("AM1").Text & "\" 'kam sa ma ulozit obrazok
.Range("A2:U40").Copy 'oblast ktora sa ma ulozit
.Pictures.Paste.Select
End With
NazObr = Selection.Name
With Selection
ObrH = .ShapeRange.Height
ObrW = .ShapeRange.Width
End With
List.Cells(1, Columns.Count).Select
Set Graf = List.ChartObjects.Add(10, 10, ObrW, ObrH).Chart
With Graf
.Parent.Border.LineStyle = 0
List.Shapes(NazObr).Copy
.ChartArea.Select
.Paste
.Export Filename:=Cesta & Nazov, FilterName:="PNG"
.Parent.Delete
End With
List.Shapes(NazObr).Delete
Application.ScreenUpdating = True
End Sub
citovat