#1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1
Default Delete Chart Event

Hi All

Is it possible to detect an event when a chart is being deleted in vba?

Thanks a million
Kike
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default Delete Chart Event

Hi,

There is no delete event. But you could try this.
The Deactive event is fired when you delete a chart sheet. Trouble is
the chart is still there when you are in the event so you can not tell
the difference between deactivate or delete. So you use a routine to
issue a OnTime call to another routine. Store a reference to the chart
sheet in a module level variable. The when the ontime routine runs,
about a sec or 2 later, you can check the object. If deleted it will
result in an error which you can trap.

If you intend to stop the user deleting, which is why you want to
capture the event then this will not work. Instead you could try
disabling the menu entry points in to chart deletion.

Cheers
Andy

El vengador de la capa wrote:
Hi All

Is it possible to detect an event when a chart is being deleted in vba?

Thanks a million
Kike


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1
Default Delete Chart Event

Hi Andy
Thanks for the suggestion. I had already tried that. The problem is every
time the user selects a different chart or a cell the chart fires the
Deactivate event... although the chart is still there. So I'm not sure I can
make it work that way.
I'm not versed in VBA. Im much more used to other languages. It is hard to
believe that no event is fired when an object is deleted. Is there a way to
trap event through lower level code?

Cheers
Kike


"Andy Pope" wrote:

Hi,

There is no delete event. But you could try this.
The Deactive event is fired when you delete a chart sheet. Trouble is
the chart is still there when you are in the event so you can not tell
the difference between deactivate or delete. So you use a routine to
issue a OnTime call to another routine. Store a reference to the chart
sheet in a module level variable. The when the ontime routine runs,
about a sec or 2 later, you can check the object. If deleted it will
result in an error which you can trap.

If you intend to stop the user deleting, which is why you want to
capture the event then this will not work. Instead you could try
disabling the menu entry points in to chart deletion.

Cheers
Andy

El vengador de la capa wrote:
Hi All

Is it possible to detect an event when a chart is being deleted in vba?

Thanks a million
Kike


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default Delete Chart Event

Hi,

There are many events that are not catered for not just chart deletion.
If there is lower level code I do not know it.

Cheers
Andy

El vengador de la capa wrote:
Hi Andy
Thanks for the suggestion. I had already tried that. The problem is every
time the user selects a different chart or a cell the chart fires the
Deactivate event... although the chart is still there. So I'm not sure I can
make it work that way.
I'm not versed in VBA. Im much more used to other languages. It is hard to
believe that no event is fired when an object is deleted. Is there a way to
trap event through lower level code?

Cheers
Kike


"Andy Pope" wrote:


Hi,

There is no delete event. But you could try this.
The Deactive event is fired when you delete a chart sheet. Trouble is
the chart is still there when you are in the event so you can not tell
the difference between deactivate or delete. So you use a routine to
issue a OnTime call to another routine. Store a reference to the chart
sheet in a module level variable. The when the ontime routine runs,
about a sec or 2 later, you can check the object. If deleted it will
result in an error which you can trap.

If you intend to stop the user deleting, which is why you want to
capture the event then this will not work. Instead you could try
disabling the menu entry points in to chart deletion.

Cheers
Andy

El vengador de la capa wrote:

Hi All

Is it possible to detect an event when a chart is being deleted in vba?

Thanks a million
Kike


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete a Column when in a Macro-Worksheet Event? jeannie v Excel Worksheet Functions 2 July 19th 07 01:58 AM
How to Track Column Insert/Delete Event in Excel mac_excel New Users to Excel 3 July 8th 05 12:11 AM
Chart, Series delete event sino Charts and Charting in Excel 1 March 29th 05 01:31 AM
Chart, series delete event over context menue sino Charts and Charting in Excel 0 March 28th 05 12:49 AM
How do I 'catch' a 'delete cells' event Eric Excel Discussion (Misc queries) 2 March 9th 05 07:22 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"