Bypass Save dialog on uidoc.close

Seems I can’t get around the Save Dialog prompt when closing the uidoc, any help would be appreciated, here is the relavant code I am currently using:

Set db = ses.CurrentDatabase

Set uidoc = ws.CurrentDocument

Call uidoc.Save

Set doc = uidoc.Document

Set rtitem = doc.GetFirstItem(“Body”)

If rtitem.Type = RICHTEXT Then

Set object = rtitem.Embedobject(EMBED_ATTACHMENT, “”, FileName)

End If

Call uidoc.fieldsettext(“SaveOptions”, “0”)

Call uidoc.Close

Call ws.EditDocument(False, doc)

thanks!

Subject: Bypass Save dialog on uidoc.close

Try replacing

Call uidoc.fieldsettext(“SaveOptions”, “0”)

to

doc.SaveOptions = “0”

Subject: RE: Bypass Save dialog on uidoc.close

No change. :frowning:

Thanks for the suggestion though.

Subject: RE: Bypass Save dialog on uidoc.close

Hmm, it seem to work for me.

Sub Click(Source As Button)

Dim ses As New NotesSession

Dim ws As New NotesUIWorkspace

Set db = ses.CurrentDatabase

Set uidoc = ws.CurrentDocument

Call uidoc.Save

Set doc = uidoc.Document

Set rtitem = doc.GetFirstItem("Body")



If rtitem.Type = RICHTEXT Then

	FileName = "c:\\temp\\junk.txt"

	Set object = rtitem.Embedobject(EMBED_ATTACHMENT, "", FileName)

End If



doc.SaveOptions = "0"

Call uidoc.Close 

Call ws.EditDocument(False, doc) 

End Sub

I’m assuming you’re in edit mode for this to work. If you have an editable field “SaveOptions” I’d remove it. Also, if the document already has a “SaveOptions” field remove it.

I can e-mail you my test db if you can’t get it working.

Subject: RE: Bypass Save dialog on uidoc.close

Raymond, thanks for the help. I created a blank form with only the button and the Body field and it worked fine.

I am trying to do this within the memo form, using the standard r6 template. So there must be something else that is causing the Save dialog to come up.

Subject: Bypass Save dialog on uidoc.close

In what event do you have this code?

Subject: RE: Bypass Save dialog on uidoc.close

It is in an action button.

Subject: Problem is that you are modifying the uidoc after saving…

Try:Set db = ses.CurrentDatabase

Set uidoc = ws.CurrentDocument

Set doc = uidoc.Document

Set rtitem = doc.GetFirstItem(“Body”)

If rtitem.Type = RICHTEXT Then

Set object = rtitem.Embedobject(EMBED_ATTACHMENT, “”, FileName)

End If

Call uidoc.Refresh(True)

Call uidoc.Save

Call uidoc.Close

Call ws.EditDocument(False, doc)