- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Select Tab in the Container using Macro
Hi, All!
I have a Container with two tabs (two different tables inside). How could I using macro select one tab or another (accordingly user will see one table or another)?
Thanks.
- Tags:
- container
- « Previous Replies
-
- 1
- 2
- Next Replies »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I have a number of buttons each for activating a spesific tab in a container.
Just in the "actions" section of the button properties, I selected "run macro" and specified the macro name there.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add a Button to trigger the Macro.
First you have to Set Variable to pass to the macro as it is not allowed to pass variables in the macro call. (vMCont and vMTab)
vMCont = container Object ID
vMTab = See Container - General - Label for Selected Item
Run macro = SetTabInContainer
Paste following code in to the macro editor
Sub SetTabInContainer
Set Container = ActiveDocument.Variables("vMCont")
Set Tab = ActiveDocument.Variables("vMTab")
Call InteranlSetTabInContainer(Container.GetContent.string,Tab.GetContent.string)
end sub
Sub InteranlSetTabInContainer (Container, Cname)
NewIndex = 0
Set ContainerObj = ActiveDocument.GetSheetObject(Container)
set ContProp=ContainerObj.GetProperties
for i = 0 to ContProp.ContainedObjects.Count - 1
if ContProp.ContainedObjects.Item(i).Text.v = Cname then
NewIndex = i
End IF
next
ContProp.SingleObjectActiveIndex = NewIndex
ContainerObj.SetProperties ContProp
end Sub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was an issue that I brought up to R&D a while ago. Those who are using certain versions QlikView will notice that these properties no longer produce the desired result. The API for getting the active object and changing the active object programmatically can be found in this article with examples: https://support.qlik.com/articles/000070090
- « Previous Replies
-
- 1
- 2
- Next Replies »