Hi,
I have a worksheet that creates and sends an email via outlook and it has been working fine for the last few years.
The email includes a chart (as a picture), tables and text. For some reason the macro stopped working on my pc, it still works on other computers, which is strange.
This is the part it is getting stuck on:
Sub createJpg2(Namesheet As String, nameRange As String, nameFile As String)
ThisWorkbook.Activate
Worksheets(Namesheet).Activate
Set plage = ThisWorkbook.Worksheets(Namesheet).Range(nameRange)
plage.CopyPicture
With ThisWorkbook.Worksheets(Namesheet).ChartObjects.Add(plage.Left, plage.Top, plage.Width, plage.Height)
.Activate
.Chart.Paste
.Chart.Export Environ$("temp") & "\" & nameFile & ".png", "PNG"
End With
Worksheets(Namesheet).ChartObjects(Worksheets(Namesheet).ChartObjects.Count).Delete
Set plage = Nothing
End Sub
Bookmarks