If you're doing this in code IMMEDIATELY after you've created the document object, then you would use something like:
Dim DocEntry AS Integer = SBOCompanyObject.GetNewObjectKey()
If it's not immediately afterwards, you have to search for it using a SQL query....