SaveAs Method Example

This example saves an existing file to another web under a new name. (It isn't necessary to change the name of the file.) The program first activates the container web, and then opens the file so that a page window is established for the file. The page window is assigned to a variable and saved to a different web under a new name.

Note   You must have a file named Zinfandel.htm in the C:\My Webs folder, or change the name of the file in the program to match an existing file in your web.

Private Sub SaveAsNewFile()
Dim myFile As WebFile
Dim myPageWindow As PageWindow

Webs.("C:\My Webs").Activate
Set myFile = ActiveWeb.RootFolder.Files("Zinfandel.htm")
myFile.Open
Set myPageWindow = ActivePageWindow
myPageWindow.SaveAs ("C:\My Webs\Rogue Cellars\Zinfandel Sale.htm")
myPageWindow.Close
End Sub