WebFiles Collection






A collection of WebFile objects. Each WebFile object represents all of the open files in a Web site. The WebFile object is a member of the WebFiles collection.
Using the WebFiles object
Use the Files property to return the WebFiles collection. The following statement returns the WebFile objects in the WebFiles collection.
Set myWebFiles = Application.Webs(0).RootFolder.Files
Use WebFiles(index), where index is the ordinal number of an item in the WebFiles collection, to return a single WebFile object. The following statement returns the first WebFile object in the collection.
Set myWebFile = ActiveWeb.RootFolder.Files(0)
Use the Add method to add a WebFile object to the WebFiles collection. The following statement adds a new WebFile object to the collection of WebFiles.
myWebFiles.Add ("C:\New Web WebFiles\Sales Statistics.htm")
Use the Application property to return the Application object from within the WebFiles collection. The following statement returns the Application object from the WebFiles collection.
myApp = ActiveWeb.RootFolder.Files.Application
Use the Count property to return the number of open files in the WebFiles collection. The following statement returns the number of files in the collection of WebFiles.
myCount = Webs(0).RootFolder.WebFiles.Count
Use the Delete method to delete a WebFile object. The following statement deletes the third file in the WebFiles collection.
Webs(0).RootFolder.Files(2).Delete
Use the Parent property when you want to return the container for the WebFiles collection. The following statement returns the URL of the folder for the second file in the active Web site.
myWebFileParent = ActiveWeb.RootFolder.Files(1).Parent.Url