First, you need the same ID in both locations. You have 401 for the scrollbar, but then check 400 in the dialog event.
Ops.. my mistake in cut & paste
Second, use .sel to get the scroll location... $did(401).sel
Great! it works fine.
Thanks! Have a nice night!