Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to create a macro that deletes a list of Qlikview objects.
I already have a variable, called vOriginalObjects2, which creates a list of objects to be deleted, but the below macro only seems to delete a large chunk of them. I feel like the error is at the point where i'm saying 'for each object' and this isn't actually looking at all the objects in the list?
The variable vOriginalObjects2 contains a long list of objects such as:
Document\AnalysisBar,Document\AnalysisBubble,Document\DashTrellis3,Document\DashTrellis4,Document\TX29,Document\TX30...
And the macro is:
Sub DeleteOriginalObjects
set s=ActiveDocument.Sheets("Main")
vArray = ActiveDocument.GetVariable("vOrigObjects2").GetContent.String
chartArray =split(vArray, ",")
For each object in chartArray
s.SheetObjects(object).Close
Next
End Sub
Does anyone know where I am going wrong?
To provide a bit of context, the reason I am doing this is so I can easily find out which objects have been added to a qlikview document since the initial version. I have the list of objects from the initial version (vOriginalObjects2) and the plan is to delete all of these using the macro, then press ctrl+shift+s to see what is left.
Thanks!
Scott
FYI - I've realised what the problem was...
The macro was stopping where an initial sheet object no longer exists.
Adding 'On Error Resume Next' before the line 's.SheetObjects(object).Close' solves this
FYI - I've realised what the problem was...
The macro was stopping where an initial sheet object no longer exists.
Adding 'On Error Resume Next' before the line 's.SheetObjects(object).Close' solves this