oSh.ConnectorFormat.EndConnected
returns a boolean value indicating if the end is connected to something: check that before trying to access .EndConnectedShape
NOTE: it's worth spending some time to figure out how to use the Watch window to debug problems like this: if you set a watch on oSh
then you can browse its propeties in the Watch window when you get an error, and look for likely avenues to explore...