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: 
Not applicable

Clear Multibox

I've been trying to Clear values from a Multi Box with a Macro. I can't use the Clear All function as I only want to clear some values contained in the Multibox.

I tried the following code but it only works on List boxes.

public function clearCycle()

set mb = ActiveDocument.GetSheetObject("MB07")

mb.Clear

end function

Is there anyway to achieve this?

1 Solution

Accepted Solutions
IAMDV
Luminary Alumni
Luminary Alumni

Hi Luis Cazares lcazares,

You can't use the Clear Method to clear the selections in ListBox. This is because you can only use this method to clear the ListBox and Field. However, MultiBox is a logical object and works at the presentation layer. So you need to use the ClearMemberFields Method. Here is the code...

Sub Clear_MultiBox_Fields()

     ActiveDocument.GetSheetObject("MB01").ClearMemberFields

End Sub

In the above code ClearMemberFields checks the Fields which are used in the MultiBox ("MB01") and then it clears the selections only for this MultiBox.

I hope this helps!

Cheers - DV

View solution in original post

3 Replies
IAMDV
Luminary Alumni
Luminary Alumni

Hi Luis Cazares lcazares,

You can't use the Clear Method to clear the selections in ListBox. This is because you can only use this method to clear the ListBox and Field. However, MultiBox is a logical object and works at the presentation layer. So you need to use the ClearMemberFields Method. Here is the code...

Sub Clear_MultiBox_Fields()

     ActiveDocument.GetSheetObject("MB01").ClearMemberFields

End Sub

In the above code ClearMemberFields checks the Fields which are used in the MultiBox ("MB01") and then it clears the selections only for this MultiBox.

I hope this helps!

Cheers - DV

SunilChauhan
Champion
Champion

use below code in control+M

sub clearCycle()

set mb = ActiveDocument.GetSheetObject("MB07")

mb.ClearMemberFields


end sub

see the attached file

select one item in multibox and then click on button

hope this help

Sunil Chauhan
Not applicable
Author

Thanks to both of you, it worked perfectly.