ok right well I have managed to get the code to go in, only by putting it in this way:-
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Set cMemoObject = New UIMemoDocument
Call cMemoObject.Init(Source,Isnewdoc)
If uidoc.IsNewDoc...