Search DominoPower's 10,675 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
SCRIPTING TUTORIAL
OLE automation primer
By Chris Stoner, a.ka. GreenJellyBean

Ever wanted to manipulate your Notes data with another application, but didn't know where to start? Leveraging the strengths of other applications can be tricky, but the rewards are great. Some applications can provide capabilities that Notes either does not have at all or does not do very well. One example is sharing data with a spreadsheet. This OLE automation primer will get you familiar with launching and manipulating another application from Notes using LotusScript.

A little background
OLE (Object Linking and Embedding) automation allows one application, called the OLE server, to use another application, called the OLE client, to do some work. In our case, the OLE server will be Notes, and the OLE client will be Excel.

What we hope to do is launch Excel, send it some Notes data, have Excel crunch some numbers, and return a result which we will store in our Notes document. The example is simple, but should serve as a good starting point for you to integrate other applications with Lotus Notes.

Getting started
The Notes form is where we will do all the work in this example. If you look at Table A, you can see that we will have four fields that will store some numbers for us. We'll be sending these numbers to Excel later on.

Field name Type Value
Initial_Balance Editable, Number, Currency 1,000
Deposit Editable, Number, Currency 200
Cash_Withdrawn Editable, Number, Currency 130
Monthly_Charges Editable, Number, Currency 20

This form will mimic a checkbook. The Initial_Balance field will represent the Balance in our checkbook before all transactions. Cash_Withdrawn and Monthly_Charges are both subtractions from our Initial_Balance, while Deposit is an addition to our Initial_Balance. Create a button called "Calculate in Excel", but don't add any code to it just yet. We'll add the LotusScript code to this button in the next section.

A new Notes document created with this form should look like what you see in Figure A.

FIGURE A


Here's what your new Notes document should look like. Roll over picture for a larger image.

The script
To get these values out to Excel, we'll need to put some code behind that "Calculate in Excel" button. Copy and paste the script located at http://www.component-net.com/dp-extras/oleauto-0999.html into the Click event.

In depth
While I tried to include detailed remarks in the code, we should step through it. Also, it can be beneficial to turn on the Notes Debugger to see what's happening under the hood.

After getting a handle to the current Notes Document, it's necessary to Dim and Create our Excel objects. The first object is the application itself, which is Excel. Excel must be Dim'd as a variant. oWorkbook will be the handle to our Excel workbook. These two objects drive the entire script, and though in a more complex script, it may be necessary to create other objects, like a Sheet object.


1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Microsoft Technologies (27 articles)
   Preparing for the impending IE7 release
   How to create animated, context sensitive help for the Notes client
   Parsing XML with LotusScript and Microsoft's XML object
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
What to look for in a Domino-based document management solution
Understanding Domino.doc end-of-life options
When the debugger won't debug hidden code that isn't hidden
What to do if the LotusScript debugger won't single-step over code
Top 10 ways to launch and build a Lotus consulting practice (with a little help from the Beatles)
Troubleshooting an OpenSuse Notes install
Incident report: denial of service attack against ConnectedPhotographer.com
Latest Lotus Headlines
SnTT - Enabling ALL the bells and whistles!
Tivoli Data protection causes Domino to crash
Fun when running DB2 CLP scripts
Introducing Flippr, the easy way to admin Quickr
DXL and fake security
Using search forms in IBM Workplace Collaborative Learning 2.7
Schmidt, Freed, and Gering on the OVF Toolkit
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Eight steps to successful and reliable home backups
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Can Outlook run when it's not running (and other mysteries)?
-- Advertisement --

AUTOMATE LOTUS NOTES USER ID MANAGEMENT
ID Manager 4.5 from HELP Software provides a new level of automaton for managing Lotus Notes IDs. ID Manager lets Lotus Notes administrators get out of the business of creating and managing user IDs. Use our ROI calculator to see how quickly ID Manager will pay for itself.

Learn more about HELP Software products
-- Advertisement --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2009, ZATZ Publishing. All rights reserved worldwide.
Editor's Login