Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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
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
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
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
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
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