Spell Check and Cacel

I have a DialogBox form with the following in the QueryClose event. However, when the user is prompted with the dialog, and selects cancel, it still wants a value in the DialogBox? and checks for spelling? Any ideas how to prevent it from popping up?

Sub Queryclose(Source As Notesuidocument, Continue As Variant)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

Call uidoc.SpellCheck()

Call ws.RefreshParentNote()

End Sub

Subject: Spell Check and Cacel

I would thnk you wouldn’t want to check the spelling in the close event for exactly the reason you specified and because the document has already been saved… Therefore if there were any mistake that you need to correct … You will want to save again.

I would suggest you moved your code to the QuerySave.

Then whenever someone goes to save it checks the spelling first, then saves the document.

Subject: RE: Spell Check and Cacel

Thanks Stephen, I have tried that, but then it doesn’t actually do the spell check.

Is there a way to call the spell check in the loop of the dialogbox? Only catch is, how do you get the dialogbox as the uidoc?

**

Do While completed = False

If ws.DialogBox(“DlgForm”, True, True, False, False, False, False, “Text…”, didoc) Then

If checkDBoxFields(didoc) Then

      doc.Status = 7

      doc.Closed = Now

If doc.Resolution(0) = “” Then

doc.Resolution = didoc.Field1(0)

Else

doc.Resolution = doc.Resolution(0) & Chr$(13) & “*****” & Chr$(13) & didoc.Field1(0)

nd If

Set item = doc.GetFirstItem(“Trail”)

Call item.AppendToTextList("Text " & s.CommonUserName & " on " & Now & otherTxt$)

If doc.form(0) = “Form Name” Then

Mail

If

End If

uidoc.Save

uidoc.Close

completed = True

End If

Else

completed = True

End If

Loop

Subject: RE: Spell Check and Cacel

Sorry, I missed (the important point) you were in a dialog box - explains why the QuerySave doesn’t work and why you are doing it in the QUeryClose.

Try Stan’s idea.

Subject: Spell Check and Cacel

Assuming the cancel button is actually a dialogbox cancel button (or a button you created that has been marked as a Cancel-type button) then this will work:

If Not Source.DialogBoxCancelled Then

Call Source.SpellCheck

Call ws.RefreshParentNote

End If

(Note – there’s no reason to create a NotesUIDocument object, since you already have Source available.)

Subject: RE: Spell Check and Cacel

W-O-W, thanks Stan, it works perfectly, if we could only know about ALL the properties available, hopefully one day :slight_smile:

Thanks again!!!