Extract Microsoft Office constants into 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 | " 
 MSApps(6) = "Microsoft Project 2000 | " 
 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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.