Save Method

Microsoft FrontPage Visual Basic

Show All Show All

Save Method

ShowAs it applies to the WebPackage object.

Saves a Web package with the specified file name.

expression.Save(strFileName, fOverWrite)

expression    Required. An expression that returns a WebPackage object.

strFileName    Required String. The path and file name of the Web package. Web packages have an .fwp file name extension. The Save method does not automatically include this file name extension, so you should specify it as part of the file name.

fOverWrite    Required Long. False to not overwrite an existing file with the same file name.

ShowAs it applies to the PageWindowEx object.

Saves a specified page.

expression.Save(ForceOverwrite)

expression    An expression that returns a PageWindowEx object.

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

Example

ShowAs it applies to the WebPackage object.

The following example creates a new Web package and adds the page "test.htm" to the package, including all dependencies for the page, and then saves the new Web package.

Dim objWeb As WebEx
Dim objPackage As WebPackage

Set objWeb = ActiveWeb
Set objPackage = objWeb.CreatePackage("New Web Package")

With objPackage
    .Author = "John Smith"
    .Company = "Fourth Coffee"
    .Subject = "This is a new Web package for Fourth Coffee."
    .Add objWeb.Url & "/test.htm", fpDepsDefault
    .Save "C:\My Documents\NewWebPackage.fwp", True
End With

ShowAs it applies to the PageWindowEx object.

The following example creates a property, adds it to a file, and then saves the page.

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

Private Sub AddSaleText()
    Dim myWeb As WebEx
    Dim myFile As WebFile
    Dim mySaleProp As String
    Dim mySaleText As String

    mySaleText = "Vintage Wines for Oktoberfest Sale!!!"
    Set myWeb = Webs.Open("C:\My Documents\My Web Sites\Rogue Cellars")
    Set myFile = ActiveWeb.RootFolder.Files("Sale.htm")

    myFile.Properties.Add "SaleText", mySaleText
    mySaleProp = myFile.Properties("SaleText")
    myFile.Open
    ActiveDocument.body.insertAdjacentText "BeforeEnd", mySaleProp
    ActivePageWindow.Save
    WebWindows.Close
End Sub