Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you Access Predefined Constants

Status
Not open for further replies.

Dinobrago

Technical User
Dec 8, 2001
184
US
How can you access predefined constants (such as ForReading, ForWriting...) from within a VBScript without having to define them yourself in the script?

The same question goes for accessing xl Constants. Otherwise, I have to find out what values are represented by the constants and create the constants in a VBScript.

Dean
 

:)
paul
penny.gif
penny.gif
 
It always helps if people who post VBScript questions make it explicitly clear whether you are talking about ASP scripting, IE scripting, WSH scripting, or internal Office scripting. I'll take a guess and assume WSH here...

If you are talking about WSH scripts, you should create .WSF files instead of .VBS files.

The .WSF allows you to use the <reference> element, which loads the appropriate type library and thus gives you access to the constants for FSO, ADO, etc. etc.

See the WSH help, which can be downloaded from and look under the heading &quot;XML Elements&quot; for <reference>.

There is a lot of other cool stuff to be found under that heading too!

The previous poster gave a link to a site talking about ASP pages and putting similar references into global.asa (or I assume so, but I didn't chase the link).

If you are talking about something like VBScripts within Office it is another story, of course. Perhaps somebody else can tell you how to handle that - or perhaps you should pursue VBA instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top