P
phreud
I'm trying to use Stephen Bullen's PastePicture to copy a whole range o
cells and charts to an image handler in a userform. I've named th
range in my sheet to "display1" (it's about 40 cells x 50 rows).
I'm not sure how to copy this range to the clipboard for use with hi
function. This is what I have now:
Code
-------------------
Dim oRng As Range
Dim lPicType As Long
'Find the chart object on the sheet
Set oRng = Sheet1.Range("display1")
'Recalculate the sheet to give us a new set of random points
Sheet1.Calculate
'Do we want a metafile or a bitmap?
'If doing a 1 to 1 copy, xlBitmap will give a 'truer' rendition.
'If scaling the image, xlPicture will give better results
lPicType = xlPicture
'Update the chart type and copy it to the clipboard, as seen on screen
With oRng
.CopyPicture xlScreen, lPicType, xlScreen
End With
'Paste the picture from the clipboard into our image control
Set imgTest.Picture = PastePicture(lPicType)
-------------------
The part that I can't get working is the:
Set oRng = Sheet1.Range("display1")
How do I set it properly? I don't even know if this is doable, bu
reading throug his module, he says just about anything can be copie
and pasted with this module.
Thanks
cells and charts to an image handler in a userform. I've named th
range in my sheet to "display1" (it's about 40 cells x 50 rows).
I'm not sure how to copy this range to the clipboard for use with hi
function. This is what I have now:
Code
-------------------
Dim oRng As Range
Dim lPicType As Long
'Find the chart object on the sheet
Set oRng = Sheet1.Range("display1")
'Recalculate the sheet to give us a new set of random points
Sheet1.Calculate
'Do we want a metafile or a bitmap?
'If doing a 1 to 1 copy, xlBitmap will give a 'truer' rendition.
'If scaling the image, xlPicture will give better results
lPicType = xlPicture
'Update the chart type and copy it to the clipboard, as seen on screen
With oRng
.CopyPicture xlScreen, lPicType, xlScreen
End With
'Paste the picture from the clipboard into our image control
Set imgTest.Picture = PastePicture(lPicType)
-------------------
The part that I can't get working is the:
Set oRng = Sheet1.Range("display1")
How do I set it properly? I don't even know if this is doable, bu
reading throug his module, he says just about anything can be copie
and pasted with this module.
Thanks