Call the code from the done event (it's not actually called Done, but I don't know the exact wording) of the web browser control would be the best way, I would think.
Within the object element, there is a property called readyState. You can check this property to determin what state the object is at. 0 - Object is not initialized 1 - Object is loading 2 - Object is finished loading 3 - User can use the object, but it may not be fully loaded 4 - Object is completely initialized. There is an event called onReadyStateChange (I think). This gets fired when the readyState of the object changes.