Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Delete Object VBS

Hello,

I created a table with some random Dimension and Expression

Set Table = ActiveDocument.ActiveSheet.CreateStraightTable

Table.AddDimension ("Title"&Suffix)

Table.AddExpression ("[Current State"&Suffix&"]")

.

Now, when I want to use filters to order by some criteria, I want to rebuild everything the table like I did before, but with CreateStraightTable, it will generate again a new table and I want to drop the old table.

I thought about doing :

Set the_table = ActiveDocument.GetSheetObject("Table")         // Where Table is the name from my current Sheet.

the_table.Cut

or:

the_table.Remove

or:

the_table.DeleteObject()

But none of those are working.

Could someone give me a hint?

Thanks

1 Solution

Accepted Solutions
Not applicable

Re: Delete Object VBS

Hello,

Thanks for the quick reply.

It deletes all Objects from the Sheet.

But with a bit of adaptation I figured out the rest and this link:

http://community.qlik.com/thread/3177

'Delete Previous Chart

rem ** remove one sheet object on sheet Main **

set s=ActiveDocument.Sheets("Main")

orignumber=s.NoOfSheetObjects

for i=0 to orignumber-1

     rem ** get unique object ID for given object on sheet **

     set so = s.SheetObjects(i)

     id = so.GetObjectId

     'Prints all objects ids on the current sheet

     'msgbox("ID = " & id)

     'Prints Table ID

     IF id = "Document\Table" THEN

         'TableBox to be deleted

         s.SheetObjects(i).Close

     END IF

next

2 Replies
Gysbert_Wassenaar
Not applicable

Re: Delete Object VBS

You need to use the close() member:

rem ** remove all sheet objects on sheet Main **

set s=ActiveDocument.Sheets("Main")

orignumber=s.NoOfSheetObjects

for i=0 to orignumber-1

    s.SheetObjects(0).Close

next


talk is cheap, supply exceeds demand
Not applicable

Re: Delete Object VBS

Hello,

Thanks for the quick reply.

It deletes all Objects from the Sheet.

But with a bit of adaptation I figured out the rest and this link:

http://community.qlik.com/thread/3177

'Delete Previous Chart

rem ** remove one sheet object on sheet Main **

set s=ActiveDocument.Sheets("Main")

orignumber=s.NoOfSheetObjects

for i=0 to orignumber-1

     rem ** get unique object ID for given object on sheet **

     set so = s.SheetObjects(i)

     id = so.GetObjectId

     'Prints all objects ids on the current sheet

     'msgbox("ID = " & id)

     'Prints Table ID

     IF id = "Document\Table" THEN

         'TableBox to be deleted

         s.SheetObjects(i).Close

     END IF

next