SaveAs Method

Microsoft FrontPage Visual Basic

SaveAs Method

Writes the specified page object to the destination URL.

expression.SaveAs(DestinationUrl, ForceOverwrite)

expression    An expression that returns a PageWindowEx object.

DestinationUrl    Required String. A string that contains the entire URL for the Web site, such as “C:\My Documents\My Web Sites\Adventure Works\index.htm”. This can be any URL for a Web site, such as http://web server   /folder   /file    or file://file system   /folder   /file    for disk-based Web sites.

ForceOverwrite    Optional Boolean. False to not save over an existing file. The default value is True.

Example

The following example saves an existing file to another Web site under a new name. (It isn't necessary to change the name of the file.) The program first activates the container Web site, and then it opens the file and saves it to a different Web site with a new name.

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

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

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