I have written some code that copies rows from an excel spreadsheet and then copies them into a lotus memo for emailing. The email automatically sends, which is what i want, but the message still shows up as a new memo and does not close after being sent. I am trying to use the method uidoc.Close(True) but that asks me do I want to save, discard, or cancel. I would like it to just automatically close. I have been told to use uidoc.FieldSetText(“SaveOptions”,“1”)but after adding this when I press my button in excel I get an error that this field does not exist. Please help me. Thanks
Subject: uidoc.Close(True) options
You can get a handle to the backend document and set SaveOptions that way…eg:
Dim Doc As NotesDocument
Set Doc = uidoc.Document
Doc.SaveOptions = “1”
Call uidoc.Close
Before the ‘uidoc.Close’ you may need something like:
Call uidoc.Refresh (or Call uidoc.Reload) to get the uidoc to refresh values from its corresponding back-end document if you still get prompted to save / close.
Alex
Subject: RE: uidoc.Close(True) options
it should actually be
SaveOptions = “0”
to discard without saving
Can you post ALL of your code so we can make suggestions?
Subject: Oops…thanks Paul. Missed that one!
Subject: RE: uidoc.Close(True) options
Come on somebody please help me out here…
Subject: RE: uidoc.Close(True) options
That is what I am doing and it doesn’t work. Yes, I realize it should be 0 for no promput but NOTHING is working. here is the actual code
Dim doc As Object
Set doc = Maildb.CREATEDOCUMENT
Dim ws, uidoc, db, uidb, NotesAttach As Object
Set ws = CreateObject("Notes.NotesUIWorkspace")
Set uidoc = ws.EDITDOCUMENT(True, doc)
Call uidoc.GOTOFIELD("Body")
Selection.Copy
uidoc.Paste
Call uidoc.Save
Set doc = uidoc.DOCUMENT
doc.SAVEMESSAGEONSEND = SaveIt
doc.PostedDate = Now() doc.send False, Recipient
Call uidoc.fieldsettext("SaveOptions", "0")
Call uidoc.Close(True)
Subject: RE: uidoc.Close(True) options
Using Doc.SaveOptions = “0” or Doc.SaveOptions = “1” still promts me with the box.
Subject: uidoc.Close(True) options
to close the memo and save as draft try:'allows doc to close and go to drafts without prompt
uidoc.Document.ReplaceItemValue(“ActionInProgress”,“4194304”)
'allows doc to close and go to sent without prompt
Call uidoc.Document.ReplaceItemValue(“ActionInProgress”,“1024”)
-Adam