Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
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.




[ Prev ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- 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 --

DEPARTMENT CALENDAR - MANAGE AND SHARE A COMMON CALENDAR WITH YOUR TEAMS
Are you responsible for improving your organization's Group Calendaring tool? Have you been tasked to find a true group calendar tool with Itinerary, Time-Off, Sign In/Out and Bulletins/Events module that seamlessly integrates with Domino calendaring?

If so, Logic Springs Technologies will make answering these questions a whole lot easier!

Learn how by visiting us at: http://www.departmentcalendar.com

Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.