Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Excel.inc?

Reply
Thread Tools

Excel.inc?

 
 
Agoston Bejo
Guest
Posts: n/a
 
      08-19-2004
Hi, is there somewhere a file that holds constants for Excel Automation
ActiveX objects, such as adovbs.inc for ADO constants?

Thx


 
Reply With Quote
 
 
 
 
Steve Fulton
Guest
Posts: n/a
 
      08-19-2004
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
 
Reply With Quote
 
 
 
 
Christoph Basedau
Guest
Posts: n/a
 
      08-19-2004
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments