Please follow the MicroStation Programming forum best practices.
Code Syntax Highlighting
When you post code, use the Forum advanced editor's syntax highlighting tool. That's the icon that resembles a pencil: 
[quote user="MarcinL"] Set oElement = ActiveModelReference.GetElementByID(ClipId)[/quote]
Where is variable ClipId defined? You pass ElementId to your Sub, but don't use it.