Search code examples
excelvbareadonlyopentext

VBA excel make read only a text file


Is it possible to open a text file as readOnly with the workbooks.opentext method? When I try to run a macro while the file is opened by an other user I get the message "file in use".

There is no readOnly option avalaible in the Opentext expression;

OpenText( Filename , Origin , StartRow , DataType , TextQualifier , ConsecutiveDelimiter , Tab , Semicolon , Comma , Space , Other , OtherChar , FieldInfo , TextVisualLayout , DecimalSeparator , ThousandsSeparator , TrailingMinusNumbers , Local )

Meanwhile there is a ReadOnly option available with the Worbooks.Open method.

Thank you


Solution

  • Instead of Workbooks.OpenText use Workbooks.Open