ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a chart (https://www.excelbanter.com/excel-programming/345250-selecting-chart.html)

Chimanrao

selecting a chart
 
how can i find out i a selection has a chart or not?
Regards
Chimanrao


Tom Ogilvy

selecting a chart
 
If typename(selection) = "Chart" then

Based on a later question, perhaps you are trying to see if a chart is
located over the selection (cells don't contain charts). You can do this

if the selection is a range of cells:

Dim cobj as ChartObject, rng as Range
for each cobj in Activesheet.ChartObjects
set rng = Range(cobj.topLeftCell,cobj.BottomRightCell)
if not intersect(rng,selection) is nothing then
msgbox cobj.Name & " is located over selection"
end if
Next

--
Regards,
Tom Ogilvy


"Chimanrao" wrote in message
oups.com...
how can i find out i a selection has a chart or not?
Regards
Chimanrao




Chimanrao

selecting a chart
 
what is the typename equivalent in COM?
I get a IDispatch pointer when I do GetSelection on the application
object.
If i do a QueryInterface for the _Chart interface, i get a null .


Chimanrao

selecting a chart
 
what is the typename equivalent in COM?
in com the selection is returned as a IDispatch pointer.
When I do a query interface on it for _Chart, it fails.


Chimanrao

selecting a chart
 
what is the typename equivalent in COM?
in com the selection is returned as a IDispatch pointer.
When I do a query interface on it for _Chart, it fails.



All times are GMT +1. The time now is 07:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com