<< 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 TextMaker. It is accessed directly through the Application.RecentFiles object:
' Show the name of the first recent file in the File menu
MsgBox tm.Application.RecentFiles.Item(1).Name
' Open the first recent file in the File menu
tm.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 TextMaker – 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" – in other words: the number of recently opened files that 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 TmSaveFormat) specifies the file format of the document to be added. The possible values are: |
tmFormatDocument = 0 ' TextMaker document
tmFormatTemplate = 1 ' TextMaker document template
tmFormatWinWord97 = 2 ' Microsoft Word 97 and 2000
tmFormatOpenDocument = 3 ' OpenDocument, OpenOffice.org, StarOffice
tmFormatRTF = 4 ' Rich Text Format
tmFormatPocketWordPPC = 5 ' Pocket Word for Pocket PCs
tmFormatPocketWordHPC = 6 ' Pocket Word for Handheld PCs (Windows CE)
tmFormatPlainTextAnsi = 7 ' Text file with Windows character set
tmFormatPlainTextDOS = 8 ' Text file with DOS character set
tmFormatPlainTextUnicode = 9 ' Text file with Unicode character set
tmFormatPlainTextUTF8 = 10 ' Text file with UTF8 character set
tmFormatHTML = 12 ' HTML document
tmFormatWinWord6 = 13 ' Microsoft Word 6.0
tmFormatPlainTextUnix = 14 ' Text file for UNIX, Linux, FreeBSD
tmFormatWinWordXP = 15 ' Microsoft Word XP and 2003
tmFormatTM2006 = 16 ' TextMaker 2006 document
tmFormatOpenXML = 17 ' Microsoft Word 2007 and later
tmFormatTM2008 = 18 ' TextMaker 2008 document
tmFormatOpenXMLTemplate = 22 ' Microsoft Word document template 2007 and later
tmFormatWinWordXPTemplate = 23 ' Microsoft Word document template XP and 2003
tmFormatTM2012 = 27 ' TextMaker 2012 document
tmFormatTM2016 = 28 ' TextMaker 2016 document
tmFormatTM2016Template = 29 ' TextMaker 2016 document template
If you omit this parameter, the value tmFormatDocument will be assumed. |
Tip: Independent of the value for the FileFormat parameter, TextMaker 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.rtf to the File menu
tm.Application.RecentFiles.Add "Test.rtf", tmFormatRTF
' Do the same, but evaluate the return value (mind the parentheses!)
Dim fileObj as Object
Set fileObj = tm.Application.RecentFiles.Add("Test.rtf", tmFormatRTF)
MsgBox fileObj.Name