NotesUIWorkspace Import method and "Document command is not available"

I am creating a memo in the UI in the current user’s mail file. I am building the text, populating the Body field, and then importing the signature as an .html file.

However, when I attempt to call the Import method, it throws the “Document command is not available” error.

Here is the code:

'Open Memo for user in user's mailbox... 

'First, turn off signature... 

Set docMailProfile = dbMail.GetProfileDocument("CalendarProfile") 

strProfileEnableSignature = docMailProfile.EnableSignature(0) 

If strProfileEnableSignature = "1" Then 

	docMailProfile.EnableSignature = "" 

	Call docMailProfile.Save(True, False) 

End If



'Create the memo... 

Set docEmail = dbMail.CreateDocument 

docEmail.Form = "Memo"

Call docEmail.ComputeWithForm(False, False)

'Need to remove the Body, then add the text, then add a signature if there is one... 

Call docEmail.RemoveItem("Body") 

Set emailBody = docEmail.CreateRichTextItem("Body") 



'......building the body here......



'Show the memo... 

Call docEmail.ComputeWithForm(False, False)         

Set docUIMemo = w.EditDocument(True, docEmail)



'Add the signature... 

sigOption = docMailProfile.SignatureOption(0) 

Select Case sigOption 

Case "1" 

	Call docUIMemo.FieldAppendText("Body", docMailProfile.Signature_1(0)) 

Case "2" 

	sigFilePath = docMailProfile.Signature_2(0) 

	sigExtension = Right(sigFilePath, Len(sigFilePath) - Instr(sigFilePath, ".")) 

	Select Case sigExtension 

	Case "jpeg", "jpg": 

		sigFileFilter = "JPEG Image" 

	Case "gif": 

		sigFileFilter = "GIF Image" 

	Case "bmp": 

		sigFileFilter = "BMP Image" 

	Case "htm", "html": 

		sigFileFilter ="HTML File" 

	Case "txt": 

		sigFileFilter ="ASCII Text" 

	End Select 

	Call docUIMemo.Import(sigFileFilter,sigFilePath) <---------- ERROR HITS HERE

End Select 

'Turn signature back on... 

If strProfileEnableSignature = "1" Then 

	docMailProfile.EnableSignature = "1" 

	Call docMailProfile.Save(True, False) 

End If



Call docUIMemo.Reload 

The docUIMemo is in Edit Mode (set to True) when I debug.

I use this code, without any changes, in the Notes 7.0.3 client/Designer, and it works fine. I copied into the 8.5 client/designer and it is throwing this error.

I searched Notes 6/7 forum, but did not find a solution:

http://www-10.lotus.com/ldd/nd6forum.nsf/Search?SearchView&Query=import%20AND%20"document%20command"&SearchOrder=0&Start=1&Count=100

Any help would be appreciated.

Thanks!

Dan

Subject: try to add the flag for newInstance

newInstanceBoolean. Optional. If True (default), opens a new instance of notesDocument (parameter 2) in the UI. If False, changes focus to an existing instance of notesDocument if one exists, or to a new instance if one does not exist. This parameter does not apply if notesDocument is not specified or the document has a target frame.

Sounds like you should be saying somthing like

Set docUIMemoNew = w.EditDocument(True, docEmail,True)

now work with docUIMemoNew

Subject: New Instance did not work…

I still received the same error on the same line.

I changed to:

Set docUIMemo = w.EditDocument(True, docEmail, , , , True)

and still received “Document command is not available.”

I would like to know why it works in 7.x, but not in 8.x

Thanks!

Dan

Subject: Button issue

I am having the same issue. Did you manage to resolve this? Have noticed it only happens when buttons are present in the form below the rich text field which is being imported to.