Survey Object


Contains information about the Microsoft FrontPage Survey object that allows users to vote on issues and share information.
This object is supported only by Web pages or sites that are based on Microsoft SharePoint Services.
Using the Survey object
Use Lists.Item(index), where index is is the name or ordinal position of a List object of type fpListTypeSurvey, to return a single Survey object.
The following example lists the names of all surveys in the active Web site. If the Web site contains no surveys or the Web site contains no lists, a message is displayed to the user.
Sub ListAllSurveys()
'Displays the names of all survey objects in the collection
Dim lstWebList As List
Dim strName As String
Dim blnFound As Boolean
'Set found flag to false
blnFound = False
'Check if any lists exist
If Not ActiveWeb.Lists Is Nothing Then
'Cycle through lists
For Each lstWebList In ActiveWeb.Lists
If lstWebList.Type = fpListTypeSurvey Then
'Set boolen flag to found
blnFound = True
'add list names to string
If strName = "" Then
strName = lstWebList.Name & vbCr
Else
strName = strName & lstWebList.Name & vbCr
End If
End If
Next
If blnFound = True Then
'Display names of all survey objects
MsgBox "The names of all survey objects in the current Web site are:" _
& vbCr & strName
Else
MsgBox "There are no survey objects in the current Web site."
End If
Else
'Otherwise display message to user
MsgBox "The current Web site contains no lists."
End If
End Sub
Use the Lists collection's Add method to create a new list of type fpListTypeSurvey. The following example creates a new survey called NewSurvey.
Sub NewSurvey()
'Adds a new Survey to the current Web site
Dim objApp As FrontPage.Application
Dim objLists As Lists
Set objApp = FrontPage.Application
Set objLists = objApp.ActiveWeb.Lists
'Add new survey
objLists.Add Name:="NewSurvey", _
ListType:=fpListTypeSurvey, _
Description:="New Survey"
'Display message to user
MsgBox "A new survey was added to the Lists collection."
End Sub