View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default On-the-fly determination of object type?

I like to use the CopyAsPicture function. Unfortunately (at least in
XL2000), I need to code in the correct object type. I have
Dim rng As Range
Set rng = Selection
rng.CopyPicture xlPrinter, xlPicture
but that won't work for graphics or charts. Then I tried removing "As
Range" to make a general variable, but that still won't work on everything.

Is there any way I can maybe do something like:
Dim var
Set var = Selection
Obj$ = var.Type
Dim obj As Obj$
Set obj = var
obj.CopyPicture xlPrinter, xlPicture

Ed