Delete Method (WebFile) Example

This example deletes a file from the active web.

Note   To run this example, you must have a file called "C:\My Documents\My Webs\TempFile.htm" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\TempFile.htm" (for a server running on Windows NT). In either case, you may substitute an alternative web file.

Private Sub DeleteFile()
Dim myFile As WebFile

Set myFile = ActiveWeb.RootFolder.Files("TempFile")
myFile.Delete

End Sub