A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
in the sample below
I have a range A1:I29
pic1
if you select the range A1:I29 and run the code,
you have this (picture on desktop)
pic2
if you select the range A1:F26, expected result is as follows (picture on desktop)
pic3
XXXXXXXXXXXXXXXXX
[update Sep 21, 2016]
select the desired range and run the code below:
Sub RangeAsPictureOnDesktop_01()
'Sep 12, 2016
Const FName As String = "c:\users\tasos\desktop\imagename.jpg" << result on desktop
Dim pic_rng As Range
Set pic_rng = Selection
If MsgBox("select the desired range ??", vbOKCancel) = vbCancel Then Exit Sub
Dim ShTemp As Worksheet
Dim ChTemp As Chart
Application.ScreenUpdating = False
Set ShTemp = Worksheets.Add
Charts.Add
ActiveChart.Location Where:=xlLocationAsObject, Name:=ShTemp.Name
With ActiveChart.Parent
.Height = pic_rng.Height
.Width = pic_rng.Width
End With
Set ChTemp = ActiveChart
pic_rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
ChTemp.Paste
ChTemp.Export Filename:=FName, FilterName:="jpg"
Application.DisplayAlerts = False
ShTemp.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub