xlujiax

cortado

Jan 31st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. For Each hojaActual In Sheets
  2.                    
  3.                    
  4.                     For Each img In hojaActual.Shapes
  5.                          On Error Resume Next
  6.                          img.Select
  7.  
  8.                          MyPicture = Selection.Name
  9.                          With Selection
  10.                             PicHeight = .ShapeRange.Height
  11.                             PicWidth = .ShapeRange.Width
  12.                          End With
  13.  
  14.                          Charts.Add
  15.                          ActiveChart.Location Where:=xlLocationAsObject, Name:=hojaActual.Name
  16.                          Selection.Border.LineStyle = 0
  17.                          MyChart = Selection.Name & " " & Split(ActiveChart.Name, " ")(2)
  18.  
  19.                          With ActiveSheet
  20.                            With .Shapes(MyChart)
  21.                                  .Width = PicWidth
  22.                                  .Height = PicHeight
  23.                            End With
  24.  
  25.                            .Shapes(MyPicture).Copy
  26.  
  27.                            With ActiveChart
  28.                                  .ChartArea.Select
  29.                                  .Paste
  30.                            End With
  31.  
  32.                            .ChartObjects(1).Chart.Export ruta & hojaActual.Name & "-" & img.Name & ".jpg", "jpg"
  33.                            .Shapes(MyChart).Cut
  34.                         End With
  35.  
  36.  
  37.                     Next
  38.                        
  39.  
  40.                 Next
Add Comment
Please, Sign In to add comment