Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
psankepalli
Partner - Creator III
Partner - Creator III

How to get Active Sheet ID and object id to QlikView Macro

Hello Experts,

I am writing macro for my Qlikview application. there I have a scenario like below.

I need to find the Active sheet (SH01) , from there if Obj id (TXT01) is Active then my macro need to show message.

Sub Test

if ActiveDocument.ActiveSheet.GetProperties.SheetId="Document\SH14" and ActiveDocument.ActiveSheet.SheetObjects("Document\TX17").isactive then  MsgBox "Test Success"

end sub

but I am getting the error at ActiveDocument.ActiveSheet.SheetObjects("Document\TX17").isactive.

Please let me know how to check for particular text object is active or not

Thanks

KR

7 Replies
Gysbert_Wassenaar

A text object becomes active if a user clicks it. The only way to run your macro is when the user clicks the text box and you've assigned an action to it to execute that macro. But then you already know that the text box was activated because otherwise the action that executes the macro wouldn't have run. In other words you don't need you macro.


talk is cheap, supply exceeds demand
marcus_sommer

Macros should be rather not used in this way, see: Macros are Bad but what is the reason for showing a message? Maybe you could get a similar usability if you used variable-controlled visibility-conditions within the objects.

- Marcus

psankepalli
Partner - Creator III
Partner - Creator III
Author

Hi Wassenaar,

Thanik you for your reply.

I have action to that text box, when end user clicked on that text box then only my macro needs to show message.

this is i want to achive it with based on the Active sheet and Active text bbox.

Please let me know if you need any other info.

Thanks

Kesav

psankepalli
Partner - Creator III
Partner - Creator III
Author

Actually, my requirement is I want to assign chart id to the variable object. based on active sheet and active text box. then I can export Chart data to excel.

My condition should be similar like this

if ActiveDocument.ActiveSheet.GetProperties.SheetId="Document\SH01" and ActiveDocument.ActiveSheet.SheetObjects("Document\TX01").isactive then  objid="CH05"

in this script

ActiveDocument.ActiveSheet.SheetObjects("Document\TX01").isactive


is not working.


please help me.


Thanks

KR

psankepalli
Partner - Creator III
Partner - Creator III
Author

Actually my requirement is similar to this condition

if ActiveDocument.ActiveSheet.GetProperties.SheetId="Document\SH01" and ActiveDocument.ActiveSheet.SheetObjects("Document\TX01").isactive then  objid="CH05"

if ActiveDocument.ActiveSheet.GetProperties.SheetId="Document\SH01" and ActiveDocument.ActiveSheet.SheetObjects("Document\TX02").isactive then  objid="CH06"

in this script, below one is not working

ActiveDocument.ActiveSheet.SheetObjects("Document\TX01").isactive


Please let me know how to achieve this.



Thanks

KR

marcus_sommer

Like above mentioned in most cases you could better use variable-controlled visibility-conditions for objects, see here an example Re: Visibility for a text object on click on another text object in image format‌. For exporting a chart to excel you didn't need to know on which sheet it is and if it's activated or minimized or not - it will be exported.

- Marcus

psankepalli
Partner - Creator III
Partner - Creator III
Author

Hi Marcus,

Thank you for  your reply. Let me work on this with your suggestion and get back to you with the status.

Thanks

KR