Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I thought I was getting a string of selections but at some point, my selection get converted into a string something like "7 of 34" instead of the list of selections. Can I overide this? There must be some string limit the the object does not give you all the selections...
set x = ActiveDocument.GetCurrentSelections
s = x.Selections
v = x.VarId
for i = lbound(s) to ubound(s)
msgbox v(i)&" = "&s(i)
next
So, this works for me. Instead of using GetCurrentSelections I use GetSheetObject and grab my list box. Here's the code snippet I adapted to fit this need.
set LB = ActiveDocument.GetSheetObject("LB02")
for i = lbound(boxvalues) to ubound(boxvalues)
msgbox(boxvalues(i))
next
***Note that the above also only enumerates through selected list box members. I was not expecting this behaviour but am pleasantly surprised because that is exactly what I was trying to achieve.
So, this works for me. Instead of using GetCurrentSelections I use GetSheetObject and grab my list box. Here's the code snippet I adapted to fit this need.
set LB = ActiveDocument.GetSheetObject("LB02")
for i = lbound(boxvalues) to ubound(boxvalues)
msgbox(boxvalues(i))
next
***Note that the above also only enumerates through selected list box members. I was not expecting this behaviour but am pleasantly surprised because that is exactly what I was trying to achieve.