2nd Post - Can't use CreateObject Method in Profile Document?

I have a button with some Lotus Script that, when pressed, uses CreateObject to put a picture into a Rich text field. This works in a regular form, but fails on a profile document with the error “Document command not available”. The line that is causing this is: Call uidoc.CreateObject(“”,“”,filenames)

Why is this occuring? Is there a way around this on a profile document?

Thank you for any help. The full code follows:

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uidoc As Notesuidocument

Dim filenames

Dim path

Set uidoc = ws.CurrentDocument

REM Get filename from user

filenames = ws.OpenFileDialog(False, “Select picture”,“BMP|.bmp|TIFF|.tif”,"c:")

Call uidoc.GotoField( “Attachments” )

Call uidoc.CreateObject(“”,“”,filenames)

End Sub