Jack113256
New Member
- Joined
- Dec 9, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi, im trying to export the sheet as an image but theres a small chance that the output jpg file will be blank.
Is it a timing issue or something? Ive tried putting delays after exporting the image but the error still occurs sometimes.
For your info, The sheet that contains this range is not empty and contains a chart,
Is it a timing issue or something? Ive tried putting delays after exporting the image but the error still occurs sometimes.
For your info, The sheet that contains this range is not empty and contains a chart,
VBA Code:
ws.Activate
Dim rng As Range
Set rng = Range("A1:Q25")
rng.CopyPicture xlScreen, xlPicture
Set oCht = ActiveSheet.ChartObjects.Add(Left:=0, Top:=0, Width:=rng.Width, Height:=rng.Height)
oCht.Activate
With oCht.Chart
.Paste
.Export fileName:=picPathJpg, Filtername:="JPG"
End With
wb.Close SaveChanges:=False