views:

484

answers:

2

I am trying to programmatically make a PowerPoint presentation from the contents of a Lotus Notes document. This is relatively straight-forward using CreateObject("Powerpoint.Application") but I fail to find a way to access the various constants that are used in VBA.

One solution is of course to hard-code the (ten or so) values into my script, but for obvious reasons I'm a bit uneasy about that solution.

Is there a way to lookup the value of for example msoTrue or ppLayoutText with LotusScript? For example a way to query the Powerpoint.Application object for the values?

(In more compentet languages adding various Interop libraries seems to do the trick, but I haven't found a way to do that in LotusScript.)

Edit I prefer a solution that will work without any extra installation of software or dlls, apart from Office.

+2  A: 

You can have your code lookup these MS constants by creating an OLE object of type "TLI.TLIApplication" object (defined in tlbinf32.dll), and then querying that object for all of the office VBA constants. There is an MSDN article describing this technique in general here: http://msdn.microsoft.com/en-us/magazine/bb985086.aspx

There is also sample code for exactly this procedure in a LotusScript environment here: http://noteslog.com/post/ole-constants/

Note that this is a runtime-only technique. This inspection method will make all of the constants available to your code, but will not make the constants available through Intellisense in the Domino script editor.

Ed Schembor
Thanks for your answer, Ed! That's the best lead so far, and I'll consider accepting it. But I would prefer a solution that is runnable without installing any extra dlls. I have edited the question to reflect that.
Anders Lindahl
+3  A: 

This is what I use for MS Office constants: Microsoft Constants Database. There is a script library that has recently been added for Word and Excel.

Otaku
Thanks, but that just moves the problem from "keeping my own list of values" to "keeping someone elses list values up to date". I would prefer a solution where I ask the currently running Office installation what it's value for msoTrue is.
Anders Lindahl
You're up against the same issue faced by other scripts as well, such as VBScript. There is no way, other than using a Type Library DLL query, for LotusScript to be able to query the constants from the host program. The constants were built for the language (VBA, VSTO, etc.), not for the program. You've got two choices here: 1) use a Type Library or 2) maintain a list of constants in your code.
Otaku