View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jan Kronsell Jan Kronsell is offline
external usenet poster
 
Posts: 99
Default XChecking i a chart variable is empty

Thank you.

I actually ended up making an On error routine grabbing the returned error ,
if a chart is not selected.

Jan

JLGWhiz wrote:
The syntax is not correct. I don't work with charts in VBA very
often, so I would have to look up the syntax for getting to the chart
object via code, but the priciple is to check for the object type
that is selected to make sure it is a chart of some kind. Check in
the charting news group, someone there probably has it handy.


"Jan Kronsell" wrote in message
...
Thank you.

It tried that, but used IsEmpty, not IsNothing :-)

Jan

JLGWhiz wrote:
Put your relevant code inside an If...Then statement:

If Not chtDiagra Is Nothing Then
'code to do something here
End If

The code will only execute if chtDiagra has value, otherwise it goes
on to the next executable line.

"Jan Kronsell" wrote in message
...
I have the following lines:

Dim chtDiagra As Chart
Set chtDiagra = ActiveChart

How do I check if chtDiagra is empty. That will happne if no chart
is selected, when the code is run.

Jan