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

How to remove a field in a multibox, using a macro ?

Hi

I have a field in the document, by the name Market (with data M1,M2 and M3). I have a multibox with fields A, B and C(for each of the markets present in the field called, Market).

Once the document is reloaded and reduced, based upon the values present in the Market field, the fields in the multibox should be removed.i.e, if after reduction, the Market field does'nt have the value, M3 - the field called C should be removed from the multibox, as well.

So far, i could get upto here: But I do not want to make these selections inside macro - is there any other way ??

sub macrocode

     set mb =  ActiveDocument.GetSheetObject("MB01") //fetch multibox id

          set f1 = ActiveDocument.Fields("Market").Select "M1"

               if f1 <> 1 //if it cant find a value M1 in the field, Market

                    mb.RemoveField 0    //removing the corresponding field(say A) from the multbox (making sure that A is the first field in the multibox)

               end if

          else

          //Same condition as above for a different market....so on

2 Replies
Not applicable
Author

By Selections inside macro- all I mean is the Select "M1" phrase...

jagan
Luminary Alumni
Luminary Alumni

Hi,

Create two multiBoxes with different set of fields then show and hide based on the selections like this

In Properties -> Layout -> Show Conditional

=If(GetFieldSelections(Market) = 'M1', 1, 0)

Hope this helps you, if it not works then attach some sample file.  Using Macro is not best option it doesn't work as expected sometimes.

Regards,

jagan.