Property

Method

Event

 

 

OpenFile

Closes the current file and opens the specified file.

Syntax

    HRESULT OpenFile(
    BSTR newFile
    );

Parameters

newFile

[in] Name of the file to open. HTML files (*.htm, *.html), MIME HTML files (*.mht), and Text files (*.txt) are eligible.

Return Values

0 (always)

Remarks

  1. Interpretation method of the files depends on the file format.

.html, .htm

Opens as an HTML file.

.mht

Opens as a MIME HTML file.

.txt, others

Opens as a Text file after prompting the user to set options.

  1. If the current document has been modified, the user is prompted to save the document before it is closed.

Sample Codes

VBScript

dim object
set object = document.editForm
object.wec.OpenFile "c:\Document\NewFile.htm" ' Local file.
object.wec.OpenFile "http://www.namo.com/index.html" ' Remote file.

See Also

SaveFile