Villalobos
Active Member
Hello,
I would need your help regarding jpg creating. My question would be that: how is it possible to set the range until: ("A1:AP" & Lastrow)? In my file the content of this range is changing each day therefore I would like to handle "dynamically"... somehow.
This the code what I have now:
but I receive Application-defined or Object-defined error msg at this line:
After this code I have another routine which is attach this jpg to email body.
Thanks in advance your reply!
I would need your help regarding jpg creating. My question would be that: how is it possible to set the range until: ("A1:AP" & Lastrow)? In my file the content of this range is changing each day therefore I would like to handle "dynamically"... somehow.
This the code what I have now:
Code:
Sub createJpg(Namesheet As String, nameRange As String, nameFile As String)
Dim Plage As Variant
Dim Lastrow As Long
ThisWorkbook.Activate
Worksheets("Evaluation").Activate
Set Plage = ThisWorkbook.Worksheets("Evaluation").Range("A1:AP" & Lastrow)
Plage.CopyPicture
With ThisWorkbook.Worksheets("Evaluation").ChartObjects.Add(Plage.Left, Plage.Top, Plage.Width, Plage.Height)
.Activate
.Chart.Paste
.Chart.Export Environ$("temp") & "\" & nameFile & ".jpg", "JPG"
End With
Worksheets("Evaluation").ChartObjects(Worksheets("Evaluation").ChartObjects.Count).Delete
Set Plage = Nothing
End Sub
but I receive Application-defined or Object-defined error msg at this line:
Code:
Set Plage = ThisWorkbook.Worksheets("Evaluation").Range("A1:AP" & Lastrow)
After this code I have another routine which is attach this jpg to email body.
Thanks in advance your reply!