View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
EricG EricG is offline
external usenet poster
 
Posts: 220
Default How to PasteSpecial to a Different Worksheet?

I have a UDF that draws a guage on the worksheet it is embedded in using
common Office drawing shapes. I want to be able to copy a shape to the
clipboard, and then paste it back in as a picture object. The reason I want
to do this is that in Excel, text does not rotate when you rotate an object.
If I convert the object to a metafile (picture), the text will rotate
properly when I rotate the picture.

I have an object named "Shp" which in this case is a rectangle with text in
it. What I want to do is something like this:

Shp.Copy ' <-- Copy the rectangle to the clipboard
Set NewShp = Destination.Worksheet.PasteSpecial("Picture (Enhanced
Metafile)", False, False) ' <-- Paste into a new object to manipulate

"Destination" is the address of the cell containing the UDF, so
"Destination.Worksheet" points to the worksheet on which the UDF is doing the
drawing. It is not necessarily the active sheet, so I can't use
"ActiveSheet.PasteSpecial" and I don't believe I can't refer to "Selection".

I know the code above is wrong. Does anyone have a suggestion for how this
might work? I'm working in 2003 SP3 these days.

Thanks in Advance,

Eric