EmEditor Home - EmEditor Help - EmEditor Macro Reference - Editor Object

OpenFile Method

Opens an existing file.


editor.OpenFile( strFileName, nEncoding, nFlags );


editor.OpenFile strFileName, nEncoding, nFlags



Specifies the full path and name of the file to be opened.


Selects from the Encoding Constants, or specify any encoding used in the Windows Operating System. If 0 is specified or omitted, this method will open a file by an encoding predefined by the properties.


Specifies a combination of the following values. If nEncoding is 0 or omitted, all values except eeOpenAllowNewWindow will be ignored.

eeOpenAllowNewWindow Opens as a new window if the current document is titled or modified.
eeOpenDetectUnicode Detects Unicode signature (BOM).
eeOpenDetectUTF8 Detects UTF-8.
eeOpenDetectCharset Detects HTML/XML Charset.
eeOpenDetectAll Detects all encodings.


Supported on EmEditor Professional Version 4.00 or later. However, nEncoding and nFlags parameters can be omitted on Version 5.00 or later.

Copyright 2003-2016 by Emurasoft, Inc.