MonthsShown Property
Returns or sets a Long that determines how many months will be displayed in the Microsoft FrontPage Reports view. Read/write.
expression.MonthsShown
*expression * Required. An expression that returns an Application object.
Example
The following example prompts the user to enter the number of months he or she wants to view in the report, and then sets the MonthsShown property to that value. The subroutine "SetMonths" prompts the user for input, performs a validation on the input data, converts it to the correct type and sets the MonthsShown property to the new value. If the value is of an incorrect type, an error message is displayed to the user.
Sub SetMonthsShown()
'Modifies the MonthsShown property
Dim objApp As FrontPage.Application
Set objApp = FrontPage.Application
Call SetMonths(objApp)
End Sub
Sub SetMonths(ByRef objApp As Application)
'Sets the number of months to view in Reports view
Dim varNum As Variant
Dim lngNum As Long
'Prompt the user to enter a value
varNum = InputBox("Enter the number of months you wish to view in the report.")
'Check to see that the value is of the correct type
If IsNumeric(varNum) Then
'If it's numeric, convert it to Long
lngNum = CLng(varNum)
'Set the MonthsShown value to the new value
objApp.MonthsShown = lngNum
'Display the new setting information to the user
MsgBox "The MonthsShown value was set correctly." & _
" The number of months that will be shown is " _
& lngNum & "."
Else
'Otherwise, display an error message to the user
MsgBox "The input value was incorrect", vbCritical
End If
End Sub
Applies to | Application Object
See Also | OlderFile Property | RecentFile Property