Home > Domino Tips > Developer > LotusScript > Extract Microsoft Office constants into script library
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Extract Microsoft Office constants into script library


Cesar Mugnatto
03.09.2005
Rating: -4.56- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
LotusScript
Create a non-specified date picker with LotusScript code
LotusScript accesses clipboard to view copied Notes documents
LotusScript action button manages Lotus Notes mail files
LotusScript sorts a Lotus Notes document collection
Display Lotus Notes user group membership details in a tree view
Alternate version of @Command forwards subform via LotusScript
Process large arrays in Notes forms without undue coding or testing
How to use LotusScript to modify a Lotus Notes view selection
Display a custom message box using a LotusScript-generated button
Debug Lotus Notes documents using extracted data

Lotus Notes Domino Agents
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)
Top 10 Lotus Notes Domino programming and development tips of 2007
How to export data from a Lotus Notes database to a CSV file
Must-know Lotus Notes Domino agents -- 10 tips in 10 minutes
Enable or disable scheduled agents without opening the Lotus Notes database design
Creating custom views in Lotus Notes databases
Editing fields in a Lotus Notes view with Ajax
Troubleshooting a scheduled agent not running on a Global Notes Architecture (GNA) server

LotusScript
Customize the principal field of outgoing email messages
Create a non-specified date picker with LotusScript code
Resolve Notes 8 migration error: 'Database has not been opened yet'
LotusScript accesses clipboard to view copied Notes documents
LotusScript action button manages Lotus Notes mail files
LotusScript sorts a Lotus Notes document collection
Display Lotus Notes user group membership details in a tree view
Alternate version of @Command forwards subform via LotusScript
Process large arrays in Notes forms without undue coding or testing
How to use LotusScript to modify a Lotus Notes view selection

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts