CreateNewDocument Method
You can use the CreateNewDocument method to create a new document associated with a specified hyperlink.
expression.CreateNewDocument(FileName, EditNow, Overwrite)
expression Required. An expression that returns one of the objects in the Applies To list.
FileName Required String. A string expression identifying the name and path of the document. The type of document format you want used can be determine by the extension used with the filename. to output the data. You can create HTML (*.htm), Microsoft Active Server Pages (*.asp), Microsoft Excel (*.xls), Microsoft IIS (*.htx, *.idc), MS-DOS Text (*.txt), Rich Text Format (*.rtf), or Microsoft Data Access Pages (*.html). Modules can be output only to MS-DOS text format. Data access pages can only be output in HTML format. Microsoft Internet Information Server and Microsoft Active Server formats are available only for tables, queries, and forms. Note: If an extension is not provided then the data access page format (.html) is assumed. If a directory is not specfied, the default database directory is used. This directory is determined by the setting in Options dialog box.
EditNow Required Boolean. A Boolean value where True opens the document in design view and False stores the new document in the specified database directory. The default is True.
Overwrite Required Boolean. A Boolean value where True overwrites an existing document if the filename argument identifies an existing document and False requires that the filename argument specifies a new filename. The default is False.
Remarks
The CreateNewDocument method provides a way to programmatically create a document associated with a hyperlink within a control.
Example
The following example utilizes a hyperlink control's Click event. This event creates a new file named "Report.txt" when the user clicks the hyperlink control named "GenerateReport" on a form. The new file opened for editing. If a file named "Report.txt" already exists on drive C, it is replaced with this new file.
Private Sub GenerateReport_Click() ActiveControl.Hyperlink.CreateNewDocument _
"C:\Report.txt", EditNow:=True, Overwrite:=True End Sub