I don't know what you're doing wrong. It works for me. The subform acts as a wrapper so that you can add the script object to the custom library.
- From the library tab, drag a subform onto your form.
- In the hierarchy tab, right click the subform that you just added and click "insert script object"
- Put your code in the script object.
- Drag the subform from the Design View (not the hierarchy) to the Custom library tab for sharing/reuse.
- In the hierarchy, move the script object from the subform node to the page node
- Delete the subform.
To use the script object.
- Drag the custom subform onto the Design View
- In the hierarchy, move the script object under the page node
- Delete the subform.