LotusScript for Visual Basic Programmers - IBM Redbooks
LotusScript for Visual Basic Programmers - IBM Redbooks
LotusScript for Visual Basic Programmers - IBM Redbooks
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3. Open the OLE 2 Notes database which you created earlier. The view<br />
window displays.<br />
4. On the navigator pane, select Design, then Forms and then double-click<br />
the OLE 2 Document <strong>for</strong>m. The Form Design window displays.<br />
5. Move to the end of the <strong>for</strong>m and choose Create - Hotspot - Button from<br />
the menu bar.<br />
6. Type Embed Object from a File in the Button label: box.<br />
7. Next to Properties <strong>for</strong>: Button, drop down the list of available choices<br />
and select Text. Notice how the new button on the <strong>for</strong>m now displays<br />
its title.<br />
Tip With the button properties still displayed, you can also highlight<br />
the new button by dragging the cursor from left to right. This<br />
automatically changes the button properties to text properties.<br />
8. Click the fourth tab from the left and then select the Opened <strong>for</strong> reading<br />
check box. The Printed check box is selected automatically.<br />
9. On the programming pane, select the Script radio button.<br />
10. Click on the space between Sub Click(Source As Button) and End Sub<br />
and type the following <strong>LotusScript</strong> code:<br />
%INCLUDE "LSCONST.LSS"<br />
Sub Click(Source As Button)<br />
Dim workspace As New NotesUIWorkspace<br />
Dim uidoc As NotesUIDocument<br />
Dim fileName, msg As String<br />
Dim boxType As Long<br />
Set uidoc = workspace.CurrentDocument<br />
Call uidoc.FieldSetText ("ObjectCategory",<br />
"Embedding")<br />
Call uidoc.GotoField ("Object")<br />
Call uidoc.CreateObject ("1-2-3 Report", "",<br />
"D:\NOTES\DATA\123\EMBDFILE.WK4")<br />
Call uidoc.Save<br />
boxType = MB_OK + MB_ICONINFORMATION<br />
msg$ = |File has been embedded !<br />
Click OK to close this document|<br />
Chapter 11: Using Notes as an OLE 2 Automation Client: Creating Objects 179