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

Assign selection of field from multibox to field in input box

How to assign Product_Code field in multibox to vVar Variable. Can anyone help me for writing the code for the same.

Thanks and Regards

V Joseph Raj

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Joe,

what are you trying to achieve with the Macro? If you just want to have variable vVar assigned the current selections in field Product_Code, it's easier to just define the Variable vVar in variable overview like

=only(Product_Code)

if you select not more than one code at a time, or

=GetFieldSelections( Product_Code )

To choose the right function and syntax, it is best to know what you want to do with this variable, e.g. if you want it to pass into another function.

Regards,

Stefan

View solution in original post

4 Replies
swuehl
MVP
MVP

Joseph,

so you just want to display the selected Product_Code? Then I would use a formatted text box instead.

You can show the selected Product_Code: In constraints of your input box, check listed values and enter

=only(Product_Code)

Use no list or predefined values in dropdown list option, but the problem arise if the user modify this value (well, after all, it's an input box). The shown value will not refresh accordingly.

But since I don't know what you want to achieve, just give it a try.

Hope this helps,

Stefan

Not applicable
Author

Hello Stefan,

I tried the following marcro to do but I am getting a error

How to assign the Product_Code(in a Multibox) to vVAr variable(in an input box).

Sub Selector

Let prodcode=ActiveDocument.Fields("Product_Code").Select

ActiveDocument.Variables("vVar").GetContent.String=prodcode

End Sub

I have also tried

Sub Selector

ActiveDocument.Fields("Product_Code").Select prodcode

ActiveDocument.Variables("vVar").SetContent prodcode,true

End Sub

it is not working

Can you assist me.

Regards

Joe

swuehl
MVP
MVP

Joe,

what are you trying to achieve with the Macro? If you just want to have variable vVar assigned the current selections in field Product_Code, it's easier to just define the Variable vVar in variable overview like

=only(Product_Code)

if you select not more than one code at a time, or

=GetFieldSelections( Product_Code )

To choose the right function and syntax, it is best to know what you want to do with this variable, e.g. if you want it to pass into another function.

Regards,

Stefan

Not applicable
Author

Dear Stefan,

Thanks a lot, your answers satisfied with my requirements.

Regards

Joe