Colo
MrExcel MVP,
- Joined
- Mar 20, 2002
- Messages
- 1,659
- Office Version
- 2016
- 2003 or older
- Platform
- Windows
Hi All.
The following method which I wrote is a provisional one.
Before execution, you need to prepare UserForm1 with Image Control(Image1).
<pre>
Sub Test()
Dim objTemp As Object, MyChart As Chart, rngImg As Range
Selection.Copy
Set rngImg = Application.InputBox("Pls select range", Type:=8)
rngImg.Copy
Set objTemp = ActiveSheet.Shapes.AddShape(1, 1, 1, 1, 1)
objTemp.Select
ActiveSheet.Paste
objTemp.Delete
With Selection
.CopyPicture 1, 2
Set MyChart = ActiveSheet.ChartObjects.Add _
(1, 1, .Width, .Height).Chart
With MyChart
.Paste
.Export "Temp.jpg"
.Parent.Delete
End With
.Delete
End With
With UserForm1.Controls("Image1")
.Picture = LoadPicture("Temp.jpg")
.PictureSizeMode = fmPictureSizeModeZoom
End With
Kill "Temp.jpg"
UserForm1.Show
End Sub
</pre>
The following method which I wrote is a provisional one.
Before execution, you need to prepare UserForm1 with Image Control(Image1).
<pre>
Sub Test()
Dim objTemp As Object, MyChart As Chart, rngImg As Range
Selection.Copy
Set rngImg = Application.InputBox("Pls select range", Type:=8)
rngImg.Copy
Set objTemp = ActiveSheet.Shapes.AddShape(1, 1, 1, 1, 1)
objTemp.Select
ActiveSheet.Paste
objTemp.Delete
With Selection
.CopyPicture 1, 2
Set MyChart = ActiveSheet.ChartObjects.Add _
(1, 1, .Width, .Height).Chart
With MyChart
.Paste
.Export "Temp.jpg"
.Parent.Delete
End With
.Delete
End With
With UserForm1.Controls("Image1")
.Picture = LoadPicture("Temp.jpg")
.PictureSizeMode = fmPictureSizeModeZoom
End With
Kill "Temp.jpg"
UserForm1.Show
End Sub
</pre>