Add Method

       

Add method as it applies to the Lists object.

Adds a new List object to the Lists collection.

expression.Add(Name, ParentFolder, ListType, Description)

expression   Required. An expression that returns a Lists object.

Name  Required. A String that represents the name of the new list.

ParentFolder  Optional. A String that represents the parent folder associated with the List.

ListType  Optional. An FpListType constant that represents the type of list.

FpListType can be one of these FpListType constants.
fpListTypeBasicList default
fpListTypeDocumentLibrary
fpListTypeSurvey

Description  Optional. A String that represents a description of the List object.

Add method as it applies to the ListFields object.

Adds a new ListField object to the ListFields collection.

expression.Add(Name, Description, FieldType, Required, DefaultValue)

expression   Required. An expression that returns one of the above objects.

Name  Required A String that represents the name of the field.

Description  Optional A String that represents a description of the field.

DefaultValue  Optional. A Variant that defines the default value.

FieldType  Optional. An FpFieldType constant that represents the type of the new field.

FpFieldType can be one of these FpFieldType constants.
fpFieldChoice
fpFieldComputed
fpFieldCounter
fpFieldCurrency
fpFieldDateTime
fpFieldFile
fpFieldInteger
fpFieldLookup
fpFieldMultiLine
fpFieldNumber
fpFieldSingleLine default
fpFieldTrueFalse
fpFieldURL
fpFieldUser

Required  Optional. A Boolean that determines if this is a required field. True if the field is required.

Add method as it applies to the NavigationNodes object.

Adds a new file to the list of available items in the NavigationNodes collection. Use this method to add a new file to the navigation structure. For more information on using navigation nodes, see the RootNavigationNode property for the Web object, or the Children property for the NavigationNode object.

expression.Add(Url, NodeLabel, ModificationType, LeftSibling)

expression   Required. An expression that returns a NavigationNodes collection.

Url  Required String. A string that contains the path for the Web server where the file will be stored. This can be any absolute URL, such as http://web server or file://file system for disk-based webs.

NodeLabel  Required String. A string of text used to identify the NavigationNode object when viewing the navigation structure in Navigation view. The NodeLabel argument is used only as an aid to identification.

ModificationType  Required FpStructModType. The node modification type.

FpStructModType can be one of these FpStructModType constants.
fpStructBaseOnSibling Use this setting if you want to add a new node to the right of the node designated in the left sibling argument.
fpStructLeftmostChild The leftmost node in the current navigation structure.
fpStructRightmostChild The rightmost node in the current navigation structure.

LeftSibling  Optional Variant. An index into the NavigationNodes collection. It can be either a string that represents a URL, or a number that represents a node in the collection.

Remarks

Adding a new file onto the Web server (using the WebFiles.Add method) doesn't imply that you are automatically introducing the file into the navigation structure. A NavigationNode object must be created separately for the file. To create a new NavigationNode object, use the Add method for the NavigationNodes collection.

Note   When a template is used to create a new web, navigation nodes are automatically created for the files that have been added to the web by the template.

Add method as it applies to the PageWindows object.

Adds a new PageWindowEx object to the list of available open items in the PageWindows collection.

Note   Opening a new or existing file object by using the Add method for the PageWindowEx object also adds the PageWindowEx object that is associated with the opened file to the PageWindows collection.

expression.Add(FileUrl)

expression   Required. An expression that returns a PageWindows collection object.

FileUrl  Optional String. A string that contains the path for the Web server where the page will be stored. This can be any absolute URL for a file, such as http://web server/file or file://file system/file for disk-based webs.

Remarks

You can use one of three methods when you want to open HTML pages in Microsoft FrontPage page view—the Add, Edit or Open method. When you want to open, edit, then save a file in Page view that exists either on a file server or on a file system on your hard disk, use the Add method for the PageWindows object, as shown in the following statements.

Note   It doesn't matter where the files exist; they could reside on a hard disk, server, or a FrontPage web.

Dim myFile As String

myFile = "C:\Adventure Works HTML Files\Hiking.htm"
ActiveWeb.ActiveWebWindow.PageWindows.Add (myFile)

With this method, you haven't added the file to a FrontPage-based web—you've just opened it. If myFile is part of a web, and the web is currently not open, FrontPage will also open the web.

When you want to open and edit an HTML file that exists on a web, use the Edit method for the Files collection in the root folder, as shown in the following statement.

ActiveWeb.RootFolder.Files("Hiking.htm").Edit

You can use the Open method in the same way. However, you should reserve the Open method for opening files that are not HTML files, such as Microsoft Word documents, image files, and so on.

You can also use the Add method to open a new unsaved PageWindow object. You can use either of the following statements to open an unsaved page window.

Set myUnsavedPageWindow = ActiveWebWindow.PageWindows.Add()
Set myUnsavedPageWindow = ActiveWebWindow.PageWindows.Add("")

Note   You can use the expression ActiveWebWindow.PageWindows.Add("C:\My Documents\My Webs\index.htm") as a valid expression as long as index.htm is a valid FrontPage-based file that resides in My Webs. However, if index.htm does not reside in My Webs, your code will fail. To add a new page, you must follow the procedure described earlier in this section.

Add method as it applies to the Properties object.

Adds a new property to the list of available items in the Properties collection.

expression.Add(PropertyKey, PropertyValue)

expression   Required. An expression that returns the Properties collection.

PropertyKey  Required String. A string that contains the name of the property that you want to add. For more information, see the table of properties in the Properties collection topic.

PropertyValue  Required Variant. The value of the property.

Remarks

You can programmatically add and remove categories and approval ratings for the Properties collection.

Add method as it applies to the WebFiles object.

Adds a new WebFile object to the list of available items in the WebFiles collection. A WebFile object is not restrictive and can be any type of file, it is not restricted to an HTML file type—it could be an image file, a movie, or an executable file.

Note   Use this method to add a new file to a FrontPage-based web.

expression.Add(FileUrl, ForceOverwrite)

expression   Required. An expression that returns a WebFiles collection.

FileUrl  Required String. A string that contains the URL for the file such as "Inventory.htm". This can be any absolute URL for a file, such as http://web server/file or file://file system/file for disk-based webs.

ForceOverwrite  Optional Boolean.

Remarks

Accessing a single WebFile object through the WebFiles collection provides reference to a WebFile object that doesn't have access to the Page object model until the web file is opened. Once the file is open, the PageWindow object associated with the file provides access to the Page object model that is compatible with Microsoft Internet Explorer 4.0 and later. For further information on using the Page object model in your web pages, see Exploring the Object Model in FrontPage.

Add method as it applies to the WebFolders object.

Adds a new WebFolder object to the list of available items in the WebFolders collection.

expression.Add(FolderUrl)

expression   Required. An expression that returns a WebFolders collection.

FolderUrl  Required String. A string that contains the URL for the folder, such as the Images folder in C:\My Webs. This can be any absolute URL for a folder, such as http://web server/folder or file://file system/folder for disk-based webs.

Add method as it applies to the WebWindows object.

Adds a new WebWindowEx object to the WebWindows collection.

expression.Add(ViewModeEx)

expression   Required. An expression that returns a WebWindows collection.

ViewModeEx  Required. An FpWebViewModeEx enumerated constant that represents the information displayed in the new window.

FpWebViewModeEx can be one of these FpWebViewModeEx constants.
fpWebViewExAllFiles
fpWebViewExAssignedTo
fpWebViewExBrokenLinks
fpWebViewExBrowserTypes
fpWebViewExCategories
fpWebViewExCheckoutStatus
fpWebViewExComponentErrors
fpWebViewExDailyPageHits
fpWebViewExDailySummary
fpWebViewExFolders
fpWebViewExLinks
fpWebViewExMonthlyPageHits
fpWebViewExMonthlySummary
fpWebViewExNavigation
fpWebViewExOlderFiles
fpWebViewExOsTypes
fpWebViewExPage
fpWebViewExPublishStatus
fpWebViewExRecentlyAddedFiles
fpWebViewExRecentlyChangedFiles
fpWebViewExReferringDomains
fpWebViewExReferringURLs
fpWebViewExReviewStatus
fpWebViewExSearchStrings
fpWebViewExSiteSummary
fpWebViewExSlowPages
fpWebViewExTodo
fpWebViewExUnlinkedFiles
fpWebViewExUsageSummary
fpWebViewExVisitingUsers
fpWebViewExWeeklyPageHits
fpWebViewExWeeklySummary

Add method as it applies to the Webs object.

Adds a new web to the list of available items in the Webs collection.

expression.Add(WebUrl, UserName, Password, WebOpenFlags)

expression   Required. An expression that returns a Webs collection object.

WebUrl  Required String. A string that contains the path for the Web server where the web will be stored. This can be any absolute URL for a web, such as http://web server or file://file system for disk-based webs.

UserName  Optional String. The user's logon name for the Web server.

Password  Optional String. The user's password for the Web server.

WebOpenFlags  Optional. An FpWebOpenFlags constant that represents the behavior of the new web.

FpWebOpenFlags can be one of these FpWebOpenFlags constants.
fpOpenInWindow default
fpOpenNoWindow

Example

As it applies to the NavigationNodes object.

This example adds a new node called footnote.htm to the list of items in the NavigationNodes collection.

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) and a FrontPage-based file called footnote.htm. Or, you may substitute an alternative web URL or file.

Private Sub AddNewNavNode()
Dim myHome As NavigationNode
Dim myNewNode As NavigationNode
Dim myFileUrl As String

myFileUrl = "C:\My Documents\My Webs\Rogue Cellars\footnote.htm"
Set myHome = ActiveWeb.HomeNavigationNode
Set myNewNode = _
    myHome.Children.Add (myFileUrl, _
    "Footnote", fpStructLeftmostChild)
ActiveWeb.ApplyNavigationStructure
End Sub

As it applies to the PageWindows object.

This example adds the Inventory page for Rogue Cellars winery to the list of items in the PageWindows collection. When you add a page using the FileUrl argument, the page that you want to add must exist as a file—you cannot create a new page using this argument. To create an unsaved new page, refer to the description in the Add method.

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) and a file called Inventory.htm. Or, you may substitute an alternative web URL or file.

Private Sub AddPage()
Dim myPageWindows As PageWindows
Dim myPage As String

Set myPageWindows = ActiveWeb.ActiveWebWindow.PageWindows
myPage = "C:\My Documents\My Webs\Rogue Cellars\Inventory.htm"

myPageWindows.Add (myPage)
End Sub

As it applies to the Properties object.

This example adds a new file to the list of items in the Properties collection.

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

Private Sub CopyrightAdd()
Dim myWeb As WebEx
Dim myCopyright As String
Dim myCopyrightProperty As Variant

myCopyright = "Copyright 1999 by Rogue Cellars"
Set myWeb = Webs.Open("C:\My Webs\Rogue Cellers")
myWeb.Activate

ActiveWeb.Properties.Add "Copyright", myCopyright
ActiveWeb.RootFolder.Files("Zinfandel.htm").Open
ActiveDocument.body.insertAdjacentText "BeforeEnd", _
    ActiveWeb.Properties("Copyright")
ActivePageWindow.Save
ActiveWeb.Close
End Sub

As it applies to the Webs object.

This example adds a new item to the list of files in the Webs collection.

Webs.Add ("C:\My Documents\My Webs\Rogue Cellars")

As it applies to the WebFiles object.

This example adds a new WebFile object to the list of items in the Files collection.

ActiveWeb.RootFolder.Files.Add ("C:\New Web Files\Sales Statistics.htm")

As it applies to the WebFolders object.

This example adds a folder to the list of items in the WebFolders collection.

ActiveWeb.RootFolder.Folders.Add ("Distribution Centers")