Search DominoPower's 11,441 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.
OLE automation primer (continued)

Once we have a total, we need to get that value back into Notes, so we will use the same syntax to get a handle to our cell, .cells(5,1), that we used before, but append a .value to it to get the value stored in that cell.

'Get the total generated in Excel and put it in the Total field in Notes
doc.Total = oexcel.cells(5,1).value

Now we're done with Excel. Let's close the workbook that we created without saving it, and Quit Excel.

'close the file (we won't save it in this example)
oexcel.ActiveWorkbook.Close(0)

'close excel
oexcel.Quit

Setting our object handle to nothing is simply good programming. It destroys the reference to our object, which makes this object no longer accessible from our code, but in this case, we closed Excel, so we don't need this object any longer. This is simply a cleanup routine, but it's a good idea to go ahead and include it in your code.

'always set the object equal to nothing, which destroys it.
oexcel = ""

A closing caveat (of course)
Using OLE automation, other applications can lend functionality and enhance your Notes applications, but watch for performance issues. OLE automation is a wonderful thing, but it is a performance hog. I have found that it's better to use scheduled Agents that run on off-hours, when doing OLE automation server-side. On the client, your users might be more forgiving.

Now, this little bit of simple addition could have been done in Notes, but the idea is to get familiar with OLE automation and Excel. Experiment with this code -- use it as a starting point. Feel free to comment or ask questions on the PowerBoards or via email if you get stuck!

Product availability and resources
Excel information is available from Microsoft at http://www.microsoft.com/office/excel/default2.htm.

If you're interested in programming with Excel and VBA, you should check out Microsoft's resource page at http://msdn.microsoft.com/officedev/technical/articles/excel.asp.

Chris Stoner, formerly Chris Brown, is a Principal CLP Notes Developer (R4 and R5) currently based in the Washington, DC Metro Area. Other Notes Developers may recognize Chris as her alias, Green Jellybean, which is the nickname for her green Toyota RAV4. She can be contacted at green_jellybean@bookideas.com.


« Previous  ·  1  ·  2  ·  3
Other articles you might like
Home > Microsoft Technologies (30 articles)
   Making Domino work with IIS
   Preparing for the impending IE7 release
   How to create animated, context sensitive help for the Notes client
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
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.

Register by April 10 to save $200.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login