Save Method Example

This example creates a property, adds it to a file, and then saves the active page window. The ForceOverwrite argument set to True by default.

Note   To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\My Webs\Rogue Cellars" (for a server running on Windows NT), or you may substitute an alternative web URL and file.

Private Sub AddSaleText()
Dim myWeb As Web
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 Webs\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