Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

CLEAR SELECTIONS MACRO

Hi again community!!!

I have an easy cuestion for you. I am trying to create a a macro which funcionality must be clear all selections when I active one special sheet. The code I wrote was:

sub CLEAR_SLECTIONS

     Activatedocument.clearselection

end sub

In other examples I saw, this functionality was asigned by a shorcut, but this time I only see macro options (sheet properties). Could anyone help me?

Thanks in advanced!!!! Fiber9906

1 Solution

Accepted Solutions
christian77
Partner - Specialist
Partner - Specialist

Hi:

Read Eric's suggestion. Avoid macros. They work fine locally but not always via plug-in and/or via Ajax.

QV has a collection of actions already made. One of those actions is Unlock & Clear all selections.

What version of QV are you using?

If your QV does not have actions, do as you're doing.

I'd use better:

ActiveDocument.UnlockAll

ActiveDocument.ClearAll true

Ok.

View solution in original post

7 Replies
ali_hijazi
Partner - Master II
Partner - Master II

Right-Click on your button and click on properties

in the action tab add a new action under the Selection Action type and select the "clear all" action!

I can walk on water when it freezes
Not applicable
Author

I´m so sorry Ali, but I don´t understand you. On sheet properties, I select Macro tab and I assign CLEAR_SELECTIONS macro. My real problem is that script on edit module button is wrong.

I don´t see what you are trying to explain me...

Nevertheless, thanks for your soon reply!!

Fiber9906

erichshiino
Partner - Master
Partner - Master

Try this:

Go to your sheet properties -> Triggers tab

On the box with the onActivateSheet (on the top), click on Add Actions (or Edit if you already have something there)

On the new window, click on Add

Action Type = External

Action = Run Macro

Click OK

Macro Name = CLEAR_SLECTIONS

On ali_hijazi suggestion , you don't need to write your macro, you only use the action already created

For this, you can: 

Go to your sheet properties -> Triggers tab

On the box with the onActivateSheet (on the top), click on Add Actions (or Edit if you already have something there)

On the new window, click on Add

Action Type = Selection

Action = Clear All

Hope this helps,

Erich

christian77
Partner - Specialist
Partner - Specialist

triggers.jpg

Not applicable
Author

Erich, I still don´t have (or see) the options you are telling me. I attach what I am seeing...

My current version is 8.5.

clear_selection.JPG

Thanks, Fiber9906

christian77
Partner - Specialist
Partner - Specialist

Hi:

Read Eric's suggestion. Avoid macros. They work fine locally but not always via plug-in and/or via Ajax.

QV has a collection of actions already made. One of those actions is Unlock & Clear all selections.

What version of QV are you using?

If your QV does not have actions, do as you're doing.

I'd use better:

ActiveDocument.UnlockAll

ActiveDocument.ClearAll true

Ok.

ali_hijazi
Partner - Master II
Partner - Master II

I was trying to tell you that you can accomplish this by putting a Button object which when you click clears all selections

Anyways Christian77 gave you the correct answer

I can walk on water when it freezes