Jagat Pavasia
Active Member
- Joined
- Mar 9, 2015
- Messages
- 406
- Office Version
- 2021
- Platform
- Windows
dear sir ,
I want to save selected range as image as jpeg.
I have VBA code but it did not work for me due to some missing in VBA code.
please help me with edit my VBA code and reply me,
thank you
code is below :
I want to save selected range as image as jpeg.
I have VBA code but it did not work for me due to some missing in VBA code.
please help me with edit my VBA code and reply me,
thank you
code is below :
VBA Code:
Sub pics()
Dim pic_rng As Range
Dim sh_temp As Worksheet
Dim ch_temp As Chart
Dim PicTemp As Picture
Application.ScreenUpdating = False
Set pic_rng = Worksheets("Sheet3").Range("A11:D:19")
Set sh_temp = Worksheets.Add
Charts.Add
ActiveChart.Location where:=xlLocationAsObject, Name:=sh_temp.Name
Set ch_temp = ActiveChart
pic_rng.CopyPicture appearance:=xlScreen, Format:=xlPicture
ch_temp.Paste
Set PicTemp = Selection
With ch_temp.Parent
.Width = PicTemp.Width
.Height = PicTemp.Height
End With
ch_temp.Export Filename:="C:\Users\Jagat Pavasia\Desktop\report_1.jpeg"
Application.DisplayAlerts = False
sh_temp.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox ("done")
End Sub