pushkar7767
pushkar7767

Reputation: 21

i am confused in a small concepts

I am very new to VBscript and learning hard all the concepts. During my practice I am stuck with a doubt.

dim a,b,c
set a = CreateObject("scripting.filesystemobject") 'initiate the file system object'
set b = a.GetFolder("E:\test") 'returns a object . and for the instance that varaiable b refers to that returned object'
c = b.datecreated 'accesing and storing the property to a variable /C/'
msgbox "folder: " &c

When I execute this there is no error message and it works fine. But when I change

c = b.datecreated TO set c = b.datecreated than

it shows this error:

> object required:'datecreated'

I know it's a basic thing but some time small things make you learn a lot and helpful for future.

Upvotes: 2

Views: 228

Answers (1)

Ekkehard.Horner
Ekkehard.Horner

Reputation: 38745

The keyword Set is used in VBScript only for assignment of objects:

set a = CreateObject("scripting.filesystemobject")

Non-objects - like the creation date - are assigned without Set.

c = b.datecreated

(This is my favorite nastiness of VBScript.)

Upvotes: 5

Related Questions