RecentFile 属性


返回或设置 Long 类型的值,该值确定文件在 Microsoft FrontPage“报表”视图中显示为较旧之前可以在站点中存在的天数(没有经过修改)。例如,如果 RecentFile 属性设为 20,则新文件或已修改过的文件在其存在的前 20 天将归为最近的文件。归为最近的文件显示在“报表”视图的“最近增加的文件”视图中。可读写。


expression  必选。返回“应用于”列表中的对象之一的表达式。


下列示例提示用户输入归为最近的文件能够存在的天数,然后将 RecentFile 属性设置为该值。子例程 SetRecent 提示用户输入数据,验证输入数据的有效性,将该数据转换为正确的类型,然后将 RecentFile 属性设置为新值。如果该值的类型不正确,则向用户显示一条错误消息。

Sub FPRecentFile()
'Sets a value that determines how long a file can be classified recent

   Dim objApp As FrontPage.Application
   Set objApp = FrontPage.Application
   Call SetRecent(objApp)

End Sub

Sub SetRecent(ByRef objApp As Application)
'Sets the value that determines how long a file will be classified as recent
    Dim varNum As Variant
    Dim lngNum As Long
    'Prompt the user to enter a value
    varNum = InputBox("Enter the number of days a file " & _
                      "can exist before it is classified as old.")
    '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 OlderFIle value to the new value
       objApp.RecentFile = lngNum
       'Display the new setting information to the user
       MsgBox "The RecentFile value was set correctly." & vbCr & _
              "The number of days a new or modified file will be classified as recent is " _
               & lngNum & "."
       'Otherwise, display an error message to the user
       MsgBox "The input value was incorrect.", vbCritical
    End If

End Sub