Thanks Marilyn. My code does a lookup to a view to find the doc containing the RT field and then tries to process the text so does not use the uidoc. The code will eventually be run as part of a querysave event on a form presented to the user in a browser. Thanks for your help - anymore wouldbe great!...:o)