Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am new to macros.
I am exploring macros to show a tablebox ( i know the object id ) into a new empty container by just clicking a button.
Is there a way to do it?
There is a macro for that:
Sub Container
Set Obj = ActiveDocument.Sheets("Main").CreateContainer
'or Set Obj = ActiveDocument.GetSheetObject("CT01")
Set Prop = Obj.GetProperties
Prop.ContainedObjects.Add
Prop.ContainedObjects.Item(0).Def.ObjectId= "Document\TB01"
Obj.SetProperties Prop
End Sub
To go along with what Michael Solomovich says, I would only use a macro as a last resort. If there is a way without macro, then use that way instead.
Hope this helps!
Parth,
Are you sure you need a macro? Create a container, add objects you need, including the table box. Container has it's "natural" buttons to show the object. If you want to have an "Empty" container, add a text box with no text (or some help text) and caption "Empty".
Regards,
Michael
There is a macro for that:
Sub Container
Set Obj = ActiveDocument.Sheets("Main").CreateContainer
'or Set Obj = ActiveDocument.GetSheetObject("CT01")
Set Prop = Obj.GetProperties
Prop.ContainedObjects.Add
Prop.ContainedObjects.Item(0).Def.ObjectId= "Document\TB01"
Obj.SetProperties Prop
End Sub
To go along with what Michael Solomovich says, I would only use a macro as a last resort. If there is a way without macro, then use that way instead.
Hope this helps!
Thanks Michael. Sorry I am really new to QlikVIew, so I didnt know about this feature.
Awesome. Thank you so much
Similarly, is there a way to remove an object ?
Where do I get API for viewing all the methods?
Yea something like:
ActiveDocument.GetSheetObject("TX01").Close
I attached the API Guide qvw which will be helpful when writing macros. It takes some getting used to though.
Hope this helps!
Thanks..!!
I was trying to remove an object from container (which still keeps the object in a sheet).
Set Obj = ActiveDocument.GetSheetObject("CT01")
Set Prop = Obj.GetProperties
if Prop.ContainedObjects.Count <> 0 Then
Prop.ContainedObjects.Item(0).Remove
Obj.SetProperties Prop
end if
I does not seem to work.
Try this:
Set Obj = ActiveDocument.GetSheetObject("CT01")
Set Prop = Obj.GetProperties
if Prop.ContainedObjects.Count <> 0 Then
Prop.ContainedObjects.RemoveAt(0)
Obj.SetProperties Prop
end if
Awesome. It worked. Thank you so much.. I guess I have to get used to APIguide.qvw. It was a great start so far.
Thanks again..