DavidRyan520
DavidRyan520

Reputation: 18

VBS If Variable > Variable Then

I am writing a script to delete folders older than a certain time window.

The issue I am having is with an If then statement.

If strCurrentAge > strAgeCutoff Then

strCurrentAge = date diff calculation (calculates days between now and the last modified date of the folder)

strAgeCutOff = AgeCutOff.value (textbox input value from an HTA... Typical value would be 30)

strAgeCutOff as a number.

strCurrentAge seems to be recognized as a number though.

Banging my head against the wall trying to figure this out.

Upvotes: 0

Views: 444

Answers (1)

paxdiablo
paxdiablo

Reputation: 881623

If AgeCutOff is a text box, then AgeCutOff.value won't actually be a number, it will be text.

If you want a number from it, look into the CInt() function. You could also use CLng for a greater range but, unless you're talking about the ages of thngs that live substantially longer than humans, integers up to 32,000 should suffice.

Upvotes: 3

Related Questions