18.01.2013 Views

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

NotesUIDocument = EditDocument([bool]) puts the current document in<br />

edit mode.<br />

For more in<strong>for</strong>mation about the NotesCurrentDocument class, refer to<br />

Chapter 3.<br />

Let’s look at an example.<br />

Example<br />

This example executes when the user enters a field in edit mode. The script<br />

displays in<strong>for</strong>mation about the field and the document. You can try this<br />

example on a <strong>for</strong>m you created.<br />

Dim workspace As Object<br />

Dim uidoc As Object<br />

Set workspace = CreateObject("Notes.NotesUIWorkspace")<br />

Set uidoc = workspace.CurrentDocument<br />

If uidoc.EditMode Then<br />

End If<br />

If uidoc.IsNewDoc Then<br />

Else<br />

Print_<br />

("This is the " & _<br />

uidoc.CurrentField & " field")<br />

Print _<br />

("This is the " & uidoc.CurrentField & _<br />

" field of " & uidoc.WindowTitle)<br />

End If<br />

End Sub<br />

Folllowing is an explanation of the code.<br />

Current document is a unique object class in Notes. We declare uidoc as an<br />

object to reference the current document.<br />

Dim uidoc As Object<br />

We get a reference to the current document using the CurrentDocument<br />

property of the NotesUISession class and store it in uidoc.<br />

Set uidoc = workspace.CurrentDocument<br />

Chapter 9: Accessing Notes Documents 155

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!