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

Multibox selection

Hi,

I need help on macro to get specific field selected value on the multibox. Can anyone help me on this.

1 Solution

Accepted Solutions
disqr_rm
Partner - Specialist III
Partner - Specialist III

Hi XXX

If your MultiBox has expressions, I don't think this is possible. If you have fields, you can make selection to the fields in the multibox, you are interested in.

EDIT:

On second thought, it seems this macro from APIGuide can help you:

Sub GetSelected

x=ActiveDocument.GetSheetObject("MB01").GetRelevantSelections

for i = lbound(x) to ubound(x)

msgbox(x(i))

next

End Sub


View solution in original post

4 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

Hi XXX

If your MultiBox has expressions, I don't think this is possible. If you have fields, you can make selection to the fields in the multibox, you are interested in.

EDIT:

On second thought, it seems this macro from APIGuide can help you:

Sub GetSelected

x=ActiveDocument.GetSheetObject("MB01").GetRelevantSelections

for i = lbound(x) to ubound(x)

msgbox(x(i))

next

End Sub


Not applicable
Author

Hi Rakesh,

Thanks for your response.

The macro will return the Database field name and the value. Also output value is not the string type.

disqr_rm
Partner - Specialist III
Partner - Specialist III

Try this for just value portion:

Sub GetS

x=ActiveDocument.GetSheetObject("MB01").GetRelevantSelections



for i = lbound(x) to ubound(x)

msgbox(trim(mid(x(i), instr(x(i), chr(9))+1, 100)))

next

End Sub

Please note that there is a TAB between field name and value in the return array.



I have hard coded 100 for the value field length, but you may also use len() or some other function to be precise.

Not applicable
Author

Thanks Rakesh,

This is what i have done and it is working for me perfectly

Sub GetSelected()
x=ActiveDocument.GetSheetObject("MB03").GetRelevantSelections
Cname=x(0)
Cstr(Cname)
id=Right(Cstr(Cname),len(Cstr(Cname))-12)
msgbox(id)
End Sub