Excel.inc?

Discussion in 'ASP General' started by Agoston Bejo, Aug 19, 2004.

  1. Agoston Bejo

    Agoston Bejo Guest

    Hi, is there somewhere a file that holds constants for Excel Automation
    ActiveX objects, such as adovbs.inc for ADO constants?

    Thx
     
    Agoston Bejo, Aug 19, 2004
    #1
    1. Advertising

  2. Agoston Bejo

    Steve Fulton Guest

    Agoston Bejo wrote:

    > Hi, is there somewhere a file that holds constants for Excel Automation
    > ActiveX objects, such as adovbs.inc for ADO constants?


    Download and install Mark Pryor's TLViewer utility and you can create
    your own include files for COM objects.

    http://mysite.verizon.net/res1ur2j/tlviewer.htm

    --
    Steve

    Absolute faith corrupts as absolutely as absolute power. -Eric Hoffer
     
    Steve Fulton, Aug 19, 2004
    #2
    1. Advertising

  3. 19.08.2004 11:01, Agoston Bejo schrieb:

    > Hi, is there somewhere a file that holds constants for Excel Automation
    > ActiveX objects, such as adovbs.inc for ADO constants?


    You could extract the constants from the typelib and write them
    to file:


    Option Explicit

    Dim fs
    Set fs = CreateObject("Scripting.FileSystemObject")

    'Creates two IncludeFiles
    CreateIncludeFile "Excel.Application", "vbs", "C:\xlsConsts.vbs", true
    CreateIncludeFile "Excel.Application", "js", "C:\xlsConsts.js", true

    Sub CreateIncludeFile (sProgID, scrID, sOutFile, bShowImmediate)
    Dim strConsts
    strConsts = ReturnTlbEnumsFromProgId (sProgID, scrID)
    fs.CreateTextFile(sOutFile, true, 0).Write strConsts
    If bShowImmediate Then CreateObject("WScript.Shell").Run "notepad " & sOutFile
    End Sub

    Function ReturnTlbEnumsFromProgId (sProgId, scrID)
    'Thx Alex ;-)
    Dim TLA, TLI, CstEnum, CstObj, CstString, CoCls, vCst, vEndl, vCmt
    Set CoCls = CreateObject(sProgId)
    Set TLA = CreateObject("TLI.TLIApplication")
    Set TLI = TLA.InterfaceInfoFromObject(CoCls).Parent
    Call getLangParams (scrID, vCst, vEndl, vCmt)
    CstString = BuildIntro (sProgId, TLI.ContainingFile, vCmt)
    For each CstEnum in TLI.Constants
    If "_" <> Left(CstEnum.Name, 1) Then
    CstString = CstString & vbCrlf & vCmt & CstEnum.Name & vbCrlf
    For Each CstObj In CstEnum.Members
    CstString = CstString & vCst & " " & CstObj.Name _
    & " = " & CstObj.Value & vEndl & vbCrLf
    Next
    End If
    Next
    ReturnTlbEnumsFromProgId = CstString
    End Function

    Sub getLangParams (ByVal scrID, ByRef vCst, ByRef vEndl, ByRef vCmt)
    Select Case LCase(scrID)
    Case "vbs", "vbscript":
    vCst = "Const" : vEndl = "" : vCmt = "'"
    Case "js", "jscript":
    vCst = "var" : vEndl = ";" : vCmt = "//"
    Case Else
    vCst = "" : vEndl = "" : vCmt = ""
    End Select
    End Sub

    Function BuildIntro (sProgId, srv, vCmt)
    BuildIntro = vCmt & String (60, "*") & vbCrLf _
    & vCmt & "Enumerated Constants for CoClass """ & sProgID & """" & vbCrLf _
    & vCmt & "Extracted from """ & srv & """" & vbCrLf _
    & vCmt & String (60, "*") & vbCrLf
    End Function


    --
    Gruesse, Christoph

    Rio Riay Riayo - Gordon Sumner, 1979
     
    Christoph Basedau, Aug 19, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. niz
    Replies:
    2
    Views:
    1,938
    Simon Andrews
    Jul 23, 2003
  2. thewhizkid

    @INC equiv in .csh scripts ?

    thewhizkid, Jan 21, 2004, in forum: Perl
    Replies:
    1
    Views:
    1,173
    Michael Korte
    Jan 21, 2004
  3. =?Utf-8?B?dmluYXk=?=

    INC

    =?Utf-8?B?dmluYXk=?=, Nov 15, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    550
    =?Utf-8?B?dmluYXk=?=
    Nov 15, 2004
  4. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,574
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  5. Replies:
    3
    Views:
    1,761
Loading...

Share This Page