RecentFiles (collection)

<< Click to Display Table of Contents >>

RecentFiles (collection)

Access path: Application à RecentFiles

 1  Description

RecentFiles is a collection of all recently opened files listed in the File menu. The individual elements of this collection are of the type RecentFile.

 2  Access to the collection

There is exactly one instance of the RecentFiles collection during the whole runtime of PlanMaker. It is accessed directly through Application.RecentFiles:

' Show the name of the first recent file in the File menu

MsgBox pm.Application.RecentFiles.Item(1).Name

 

' Open the first recent file in the File menu

pm.Application.RecentFiles.Item(1).Open

 3  Properties, objects, collections and methods

Properties:

Count R/O

Maximum

 

Objects:

Item RecentFile (default object)

Application Application

Parent Application

 

Methods:

Add

Count (property, R/O)

Data type: Long

Returns the number of RecentFile objects in PlanMaker – in other words: the number of the recently opened files listed in the File menu.

Maximum (property, R/O)

Data type: Long

Gets or sets the setting "Recently used files in File menu", which determines how many recently opened files can be displayed in the File menu.

The value may be between 0 and 9.

Item (pointer to object)

Data type: Object

Returns an individual RecentFile object, i.e. one individual file entry in the File menu.

Which RecentFile object you get depends on the numeric value that you pass to Item: 1 for the first of the recently opened files, 2 for the second, etc.

Application (pointer to object)

Data type: Object

Returns the Application object.

Parent (pointer to object)

Data type: Object

Returns the parent object, i.e. Application.

Add (method)

Adds a document to the list of recently opened files.

Syntax:

 Add Document, [FileFormat]

Parameters:

Document is a string containing the file path and name of the document to be added.
FileFormat (optional; type: Long or PmSaveFormat) specifies the file format of the document to be added. The possible values are:

 pmFormatDocument         =  0 ' PlanMaker document

 pmFormatTemplate         =  1 ' PlanMaker document template

 pmFormatExcel97          =  2 ' Excel 97/2000/XP

 pmFormatExcel5           =  3 ' Excel 5.0/7.0

 pmFormatExcelTemplate    =  4 ' Excel document template

 pmFormatSYLK             =  5 ' Sylk

 pmFormatRTF              =  6 ' Rich Text Format

 pmFormatTextMaker        =  7 ' TextMaker (= RTF)

 pmFormatHTML             =  8 ' HTML document

 pmFormatdBaseDOS         =  9 ' dBASE database with DOS character set

 pmFormatdBaseAnsi        = 10 ' dBASE database with Windows character set

 pmFormatDIF              = 11 ' Text file with Windows character set

 pmFormatPlainTextAnsi    = 12 ' Text file with Windows character set

 pmFormatPlainTextDOS     = 13 ' Text file with DOS character set

 pmFormatPlainTextUnix    = 14 ' Text file with ANSI character set for UNIX, Linux, FreeBSD

 pmFormatPlainTextUnicode = 15 ' Text file with Unicode character set

 pmFormatdBaseUnicode     = 18 ' dBASE database with Unicode character set

 pmFormatPlainTextUTF8    = 21 ' Text file with UTF8 character set

 pmFormatMSXML            = 23 ' Excel 2007 and later

 pmFormatMSXMLTemplate    = 24 ' Excel document template 2007 and later

 pmFormatPM2008           = 26 ' PlanMaker 2008 document

 pmFormatPM2010           = 27 ' PlanMaker 2010 document

 pmFormatPM2012           = 28 ' PlanMaker 2012 document

 pmFormatPM2012Template   = 29 ' PlanMaker 2012 document template

If you omit this parameter, the value pmFormatDocument will be assumed.
Tip: Independent of the value for the FileFormat parameter PlanMaker always tries to determine the file format by itself and ignores evidently false inputs.

Return type:

Object (a RecentFile object which represents the added document)

Example:

' Add the file Test.pmdx to the File menu

pm.Application.RecentFiles.Add "Test.pmdx"

 

' Do the same, but evaluate the return value (mind the parentheses!)

Dim fileObj as Object

Set fileObj = pm.Application.RecentFiles.Add("Test.pmdx")

MsgBox fileObj.Name