Copy Method

Microsoft FrontPage Visual Basic

Copy Method

Copies the specified object to a designated URL. During the copy process you can choose to update hyperlinks or force a file overwrite if the specified object has the same name as the designated object.

expression.Copy(DestinationUrl, Unused, ForceOverwrite)

expression    An expression that returns a WebFile or WebFolder object.

DestinationUrl    Required String. The target URL.

Unused    Optional Boolean. This parameter is unused. Setting it or not setting it will have no effect on the functionality of the Copy method.

ForceOverwrite    Optional Boolean. Specifies whether to force a file overwrite when a file or folder is found with the same name. Set the argument to True to force a file overwrite. Default value is False.

Remarks

The Copy method only copies files or folders within the same Web site. You cannot copy across Web sites. However, you can use the SaveAs method for the PageWindowEx object to save a page that has its file currently located in one Web site to save the page to a file in another Web site. Or, you can use the Add method for the WebFile object to add a file that is currently located in one Web site to another Web site.

Example

This example copies a file from the Coho Winery folder to an Inventory folder within the same Web site.

Note  To run this example, you must have a Web site called "C:\My Documents\My Web Sites\Coho Winery." Or, you may substitute an alternative Web site and file name.

    Private Sub FileCopy()
    Dim myFile As WebFile

    Set myFile = ActiveWeb.RootFolder.Files("Zinfandel.htm")
    myFile.Copy "C:\My Web Sites\Coho Winery\Inventory\Zinfandel.htm"
End Sub