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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datatypes in ActiveX script

Status
Not open for further replies.

SimonTheSponge

Programmer
Feb 12, 2001
74
GB
Hi I'm using an ActiveX script. I would like to explicitly declare a variable as a string, but activex scripting does not appear to like

dim variable as [string/integer/boolean/whatever]

All variables seem to have to be declared as without a datatype essentially making them variants

Am I missing something ?
 
No you are not missing anything. VBScript does not allow explicit declarations of variables. I believe by default they are all variants.

If you want a variable to be defined as a string, number or otherwise, I would suggest casting the value that you set it to.

Ex:

Code:
strName = CStr("John Smith")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top