Explanation of code
Matt,
CInt converts a number held as a string into an integer.
Len returns the number of characters in a string or value.
Mid$ returns a subset of another string as a string. In
this case, the string in question is the Name property
of "ole" (which I assume is an ole Object variable.) Thus,
Mid("Peter",2,3) would return "ete".
The second argument in the Mid function determines the
point in the string at which the substring starts and this
is where the problem arises(if you are having a problem,
that is...)
Len("Checkbox") will always return 8, as you are
calculating the length of the string contained between the
inverted commas. If it is supposed to be testing a
variable, the correct form would be:
Len(Checkbox)
or Len(Checkbox.value) if it's an object.
If you're happy with it the way it is then:
CInt(Mid$(ole.Name, 9))
would be simpler!
Cheers, Pete
-----Original Message-----
Can someone please explain to me what this line of code
is doing. I have some idea, but would like to know
exactly what it is doing. If you could break it down that
would be great. Thanks. Matt
nChkNum = CInt(Mid$(ole.Name, Len("Checkbox") + 1))
.
|