Open Method Example

This example opens the Rogue Cellars web and the Oktoberfest Sale file, and performs the following tasks:

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\Personal\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
WebWindows.Close
End Sub