Extract Microsoft Office constants into script library

The following agent will extract the constants for several known Microsoft Office applications and dump them to a script library.

Often times, people want to refer to constants defined for Microsoft Office products in VBA but those constants are not defined in LotusScript. The following agent will extract the constants for several known Microsoft Office applications and dump them to a script library.

  Code: 'TypeLibInfo: 

Option Public
Option Declare

Sub Initialize
 
 Const MSO_OLB_PATH = "C\Program FilesMicrosoft Office\Office\" 'Wherever 
your MS Office has been installed
 
 Dim fileHandle As Integer
 Dim inFilePath As String
 Dim outFilePath As String
 Dim lcConstantsStr As String
 Dim oTLB_INFO As Variant
 Dim oConstants As Variant
 
 Dim CRLF As String
 CRLF = Chr(13) & Chr(10)
 
 Dim MSApps(7) As String
 MSApps(0) = "Microsoft Access 2000 | " 
& MSO_OLB_PATH & "MSAcc9.olb"
 MSApps(1) = "Microsoft Binder 2000 | " 
& MSO_OLB_PATH & "MSBdr9.olb"
 MSApps(2) = "Microsoft Excel 2000 | " 
& MSO_OLB_PATH & "Excel9.olb"
 MSApps(3) = "Microsoft Graph 2000 | " 
& MSO_OLB_PATH & "Graph9.olb"
 MSApps(4) = "Microsoft Outlook 2000 | "
 & MSO_OLB_PATH & "MSOutl9.olb"
 MSApps(5) = "Microsoft PowerPoint 2000 | " 
& MSO_OLB_PATH & "MSPPT9.olb"
 MSApps(6) = "Microsoft Project 2000 | " 
& MSO_OLB_PATH & "MSPRJ9.olb"
 MSApps(7) = "Microsoft Word 2000 | " 
& MSO_OLB_PATH & "MSWord9.olb"
 
 Dim uiws As New NotesUIWorkspace
 Dim msAppChoice As Variant
 
 msAppChoice = uiws.Prompt
(PROMPT_OKCANCELLIST, "Microsoft Office 
Application", "Choose one of the 
following applications to see the defined 
constants", "", MSApps)
 If Isempty(msAppChoice) Then Exit Sub
 
 Set oTLB_INFO = CREATEOBJECT({tli.typelibinfo})
 inFilePath = Trim$(Strright(Cstr(msAppChoice), "|"))
 outFilePath = Strleftback(inFilePath, ".") & ".lss"
 oTLB_INFO.ContainingFile = inFilePath
 
 Set oConstants = oTLB_INFO.Constants
 
 lcConstantsStr = {}
 Forall Obj In oTLB_INFO.Constants
  lcConstantsStr = lcConstantsStr & CRLF 
& "' " & Obj.Name + CRLF
  Forall member In Obj.Members
   lcConstantsStr = lcConstantsStr & {Const } & _
   member.NAME & { = } & _
   Cstr(member.VALUE) & CRLF
  End Forall
 End Forall
 
 fileHandle = Freefile()
 Open outFilePath For Output As fileHandle
 Print # fileHandle, lcConstantsStr
 Close fileHandle
 
 outFilePath = Inputbox("Copy the following path",
 "Output file 
created", outFilePath)
 
End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Cesar Mugnatto. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

This was first published in March 2005

Dig deeper on Lotus Notes Domino Agents

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close