Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to detach an object

1. Can I detach an object (chart) by condition of selection in a pivot table instead of using macro?

2. If I have to use Macro to detach an object, how do I trigger the macro to run for each (any) selection I made within the sheet object?

1 Solution

Accepted Solutions
Anil_Babu_Samineni

I never tried this

Try This with Onselect Trigger and give Actions for that.

Sub Detach

ActiveDocument.GetSheetObject("CH01").Detach

End Sub

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

6 Replies
Anil_Babu_Samineni

Why Do you require macro,

QlikView Macro's Are Bad

Qlikview, we do have option called Detach. Is there any reason to add macro?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

how do I find the option? I need the option to be activated by condition only. If that possible?

Anil_Babu_Samineni

Right click the Object and then See? If you want Macro. Experts will help you

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

I know you can do that manually. But I want it to be detached automatically when selection of field (condition) meet.

Anil_Babu_Samineni

I never tried this

Try This with Onselect Trigger and give Actions for that.

Sub Detach

ActiveDocument.GetSheetObject("CH01").Detach

End Sub

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

I find the following from another post:

Attach/Detach an object for selecting List Box

SUB TEST
v_AgentCnt = ActiveDocument.Evaluate("=GetSelectedCount(REGION)")
If v_AgentCnt>0 Then
ActiveDocument.GetSheetObject("CH01").Detach
Else
ActiveDocument.GetSheetObject("CH01").Attach
End If
END SUB


And put it on the field you want (Document/Properties/Triggers/Field Event Triggers) on OnChange event.
(if you're using qv lower than ver 9, Document/Properties/Macros/Field Event Triggers).