Spesso chi sviluppa applicativi Notes che
interagiscono con Office (di solito crea una macro e copia in LS il codice
della stessa) si trova a dover utilizzare le costanti di Office che in
Notes non sono presenti ecco allora allegato un breve codice da inserire
in un agente, che estrapola questi valori e permette di importarli in LS
*******************************************************************
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
************************************
Importare tutte le costanti di Microsoft Office
- 04/22/2005
- 0 commenti
0 Commenti:
Nessun Commento Trovato