Kerry and Luis,
I did indeed say that you do in fact, as Kerry pointed out, wrap the locking of a document in a using ONLY if the command is being run in the DOCUMENT EXECUTION CONTEXT...if not, AutoCAD handles the locking implicitly for you and you don't need to lock (eg. modeless dialog you would need to lock).
Mark,
It sounds like you need to construct a new Database, then use Database.ReadDwg to read your dwg file into the newly created dbase, run your add text mojo on it, save it, then dispose of the dbase as you NEW'ed it in the first place. You should be able to do this from a modal dialog as well.
Note that the method I just described will do your mojo 'in memory' and you will not see the dwg in the editor. Make sure to add DataBase.RetainOriginalThumbnailBitmap = true to keep the thumbnail as Tim pointed out.
The problem with your original code is that DocumentManager.Open is ASYNCHRONOUS - which means the line of code to open the dwg will execute, but then the program will continue blissfully on, WITHOUT waiting for your dwg to finish opening.
Hope this helps.
Cheers from London,
Glenn.