FileNew(dotName As String, fileName As String) As String

 

Creates a new file with a name of 'fileName',  as a copy of template file 'dotName'.

 

Template files are located in the application data templates folder.

 

Returns: path to new file as a string or an empty string on failure.

 

Parameters:

 

Name

Type

Description

dotName

String

The name of the template file which serves as a blueprint for the new file to be created. Templates can be added or removed by selecting New Template Manager from the Script menu.

fileName

String

The full name for the new file to be created, including extension.

 

 

Returns:

 

Type

Value

Description

String

pathToNewFile

The new file is created in a subfolder of the application data temp folder.  The full path to this file is returned by the function. If any error occurred, then an empty string is returned.

 

Available in:

 

WindowMain

WindowLink

NO

YES

 

 Used in:

 

XojoScript Name

GUID

Create Seminar Invoice with Word

31EB5A79-78E5-4A8C-9101-5B118F113AB4

Create Seminar Reminder Invoice

A3DD8BD9-6141-44A1-AA82-5A2C78042209

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%FileNew%'

 

Example XojoScript:

 

// Create a new template based word document

Dim template As String = "imSeminarInvoice.doc"

Dim pathToNewFile As String = FileNew(template, "newinvoice.doc")

If pathToNewFile = "" Then

MsgBox("Copy of template file failed!")

Return

End If