Posted by: Jerry Lees
end with, VBScript, VBScript Statements, with, with end with, working with objects
The With … End With statement allows you to execute a section of code on a specific object or class that calls methods or set properties on the object from within VBScript without referencing the object directly in the code written.
It is a way of simplifying your code, and very useful in large scripts.
(please note, these examples are snippets of code and will not work by themselves in an editor)
.FirstName = “Jerry”
.LastName = “Lees”
.URL = “http://www.gamersigs.net”
.XBoxLiveTag = “CrashSerious”
.Email = “Not-a-chance-spammers”
This would be equivalent to the following standard code:
objSomething.FirstName = “Jerry”
objSomething.LastName = “Lees”
objSomething.URL = “http://www.gamersigs.net”
objSomething.XBoxLiveTag = “JLees”
objSomething.Email = “Not-a-chance-spammers”