User (Legacy) Posted April 16, 2002 Report Share Posted April 16, 2002 Hi I am adding a picture annotation and a text box annotation to a chart using the AddExtension method twice. I want to be able to remove one of the extensions but leave the other when the chart gets adjusted. However when I use the GetExtension I only retrieve the last extension added. How do I retrieve the first extension so I can remove it but leave the other? I have included a code snippet below to illustrate how I retrieve it: 'Set ExistingAnnotX = obj.GetExtension("AnnotationX.AnnList") If fn_blnChartHasExtension(obj, ExistingAnnotX) = True Then ' v.Remove (-1) If ExistingAnnotX.Count > 0 Then ' doesn;t seem to pick up logo annotation as one? For intAnnotationCtr = 1 To ExistingAnnotX.Count If ExistingAnnotX.Item(intAnnotationCtr).ObjectType = 6 Then Select Case LCase$(ExistingAnnotX.Item(intAnnotationCtr).Text) Case "target", "drift" ' do nothing Case Else ExistingAnnotX.Remove (intAnnotationCtr) End Select Else ExistingAnnotX.Remove (intAnnotationCtr) End If Next intAnnotationCtr Else obj.ClearData CD_EXTENSIONS End If Else obj.ClearData CD_EXTENSIONS End If --------- Public Function fn_blnChartHasExtension(ByRef cfxChart1 As ChartFX, _ ByRef ExistingAnnotX As AnnotationX) As Boolean On Error GoTo ErrorHandler ' check if a chart has an existing set of annotations and if so return them, 2002-03-13 Set ExistingAnnotX = cfxChart1.GetExtension("AnnotationX.AnnList") fn_blnChartHasExtension = True Proc_Exit: On Error GoTo 0 Exit Function ErrorHandler: fn_blnChartHasExtension = False GoTo Proc_Exit End Function -- ____________________________________ Paul Nailand Visual Risk Pty Ltd u: www.visualrisk.com t: +61 (2) 9388 1370 m:+61 (0) 413 002 802 e: firstname.lastname@example.org This email and any attachments is intended only for the person to whom it is addressed. It may contain confidential information. If you receive this document in error, please immediately delete it from your system and notify the sender. You must not disclose, copy, use or rely on any part of this document if you are not the intended recipient. Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.