Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
murozel76
Contributor III
Contributor III

How to trigger a macro on every tab selection in a container

Hello All,

I have a container with 6 tabs and a number of buttons on a sheet. I have written a macro so that some of the buttons will be disabled/enabled depending on the active tab of the container. The macro works fine, however I couldn't yet find a way to make it run automatically when the active tab of the container changes i.e. on every change of the "SingleObjectActiveIndex" value of the container. Is it possible to have a trigger like this? Otherwise, I will need another button to run the macro and it should be used after each time the user changes the active tab in the container, which would be no good practice, IMO.

Any help appreciated.

Thank you in advance.

Regards,

 

sub ButtonStatus

set MV_ContainerObj = ActiveDocument.GetSheetObject("CT13")
Set MV_ContProp = MV_ContainerObj.GetProperties
MV_ActiveIndex = MV_ContProp.SingleObjectActiveIndex

set MV_Button = ActiveDocument.GetSheetObject("BU113")
set MV_ButtonProp = MV_Button.GetProperties

set v = ActiveDocument.Variables("vCT13ActiveIndex")
v.SetContent MV_ActiveIndex,true (Note: I use This document variable [vCT13ActiveIndex]  in the "enable condition" of the relevant button)

End Sub

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

There is no trigger for container selection changes, so as far as I know there is no way of firing your macro simply by changing the container selection.

You could use a manual action , but I agree that it is not a very good approach. Another alternative is to set the container tabs to drop down and overlay buttons in place of the container tabs. The buttons should select the appropriate tab and control the active state of the other buttons on the sheet.

This is a screenshot of what I mean:

test.png

I don't have a script for changing container tabs in a macro, but I am sure that you can find that in the forum.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
murozel76
Contributor III
Contributor III
Author

Thank you very much, Jonathan. I followed your advice and also managed to change the selected tab in a container via macro.

Anyway, we would be much better off if Qliktech added "trigger" functionality to all sheet objects and container tabs!

Best regards,

jonathandienst
Partner - Champion III
Partner - Champion III

murozel76 wrote:

Anyway, we would be much better off if Qliktech added "trigger" functionality to all sheet objects and container tabs!

Agreed!

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein