with the services of the OLE application. Notes can serve as the container for
the application, providing replication, security, and access control as well as
summarizing the data in views and making it possible to search for information
using Notes? full-text indexing capabilities. The OLE application can provide
services that would require extensive effort to develop in Notes, such as the
cell engine from Excel or 1-2-3 or the sophisticated text handling capabilities
of Word or Word Pro.
Notes provides the very best container for these objects, as it frees users
from having to learn the hierarchical file system (all Notes documents, even
those with objects in them, can have a word-based title). In addition, Notes?
development capabilities and integrated messaging services make using OLE
applications as part of a workflow application fast and easy.
Embedding an Entire File in a Document
You can embed an entire file from another application as an object in a Notes
document using LotusScript. The following example shows how to embed data from
a Lotus 1-2-3 spreadsheet file into a Notes document.
1. First, create a new Lotus 1-2-3 spreadsheet or use an existing spreadsheet.
In our example, we are using a new spreadsheet.
2. Save this file as EMDBFILE.WK4 in your Notes path, for example,
3. Open the OLE 2 Notes database which you created earlier. The view window
4. On the navigator pane, select Design, then Forms and then double-click the
OLE 2 Document form. The Form Design window displays.
5. Move to the end of the form and choose Create - Hotspot - Button from the
6. Type Embed Object from a File in the Button label: box.
7. Next to Properties for: Button, drop down the list of available choices and
select Text. Notice how the new button on the form now displays its title.
Tip With the button properties still displayed, you can also highlight the new
button by dragging the cursor from left to right. This automatically changes
the button properties to text properties.
8. Click the fourth tab from the left and then select the Opened for reading
check box. The Printed check box is selected automatically.
9. On the programming pane, select the Script radio button.
10. Click on the space between Sub Click(Source As Button) and End Sub and type
the following LotusScript code
11. Save the form and close it.
12. Choose Create - OLE 2 Document from the menu bar.
13. Click the Embed Object from a File button. The spreadsheet is embedded in
your document. It looks like this
14. Save and close the document.
Note You can also embed part of a file in a Notes document using LotusScript.
To do so, you need to use the object?s native LotusScript function to access
the object?s data in the object?s application. This can be a complex process.
Therefore, it might be a better choice to manually embed part of a file in a
Notes document. See our complex examples that are for sale Sub C
lick(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim fileName, msg As String
Dim boxType As Long
Set uidoc = workspace.CurrentDocument
'------------ Set the ObjectCategory item value with an Embedding string.
Call uidoc.FieldSetText ("ObjectCategory", "Embedding")
' ------------ Move the cursor to the Object item.
Call uidoc.GotoField ("Object")
' ------------ Create a new embedded object in the Object item. This embedded
object is created from the EMBDFILE.WK4 file located in the D:\NOTES\DATA\123
subdirectory. Note You will receive an error message if the file does not exist
in the subdirectory or if it is being used by another process.
Call uidoc.CreateObject ("1-2-3 Report", "","D:\NOTES\DATA\123\EMBDFILE.WK4")
Assign the button and icon constant name to the boxType variable.
boxType = MB_OK + MB_ICONINFORMATION
msg$ = |File has been embedded ! Click OK to close this document|
Messagebox msg$, boxType, "Successful"
This was first published in November 2000