Webs Collection Object

See Also         Properties         Methods        

Application object
Webs object

A collection of Web objects. Each Web object represents a web on a Web server—which can either be disk-based (on a local hard drive) or server-based. For more information on FrontPage-based webs, see Creating Web Sites. The Web object is a member of the Webs collection.

Using the Webs Collection

Use the Webs property to return the Webs collection. You can also use the Application property to return the Application object. The following statement uses the Application object to return the first item in the Webs collection or, use the second statement to return the entire collection of webs.

Set myWebOne = Application.Webs(0)
Set myWebs = Application.Webs

Use Webs(index), where index is the index number of an item in the Webs collection, to return a single Web object. The following statement returns the third web in the collection of open Web objects.

Set myGetWebThree = Webs(2)

Use the Add method to add an item to the list of available items in the Webs collection. The following statement adds the Rogue Cellars web to the Webs collection.

Webs.Add("C:\My Documents\My Webs\Rogue Cellars")

Use the Application property to return information about the application from within the Webs collection. The following statement returns the version number of the Application object.

ActiveWeb.Webs.Application.Version

Use the Count property to return the number of open webs in the Webs collection. The following statement returns the number of open webs.

Webs.Count

Use the Delete method to permanently delete a web from the Webs collection. The following statement deletes the Rogue Cellars web.

Webs.Delete("C:\My Documents\My Webs\Rogue Cellars")

Use the Open method to open a web. The following statement opens a web and adds it to the collection of items in the Webs collection.

Webs.Open("C:\My Documents\My Webs\Rogue Cellars")

Use the Parent method when you want to return the container of the Webs collection, which is the application. The following statement returns the Application object.

Set myParent = Webs.Parent