ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   opentext command (https://www.excelbanter.com/excel-programming/336819-opentext-command.html)

Ramesh Narasimhan

opentext command
 
I am trying to open a text file as part of the workbook_open event handler.
when i manually import the text by dragging the .dat file into the workbook,
it (correctly) neglects carriage returns within fields, writing them as a
hollow square. However, when I import the text through the VBA command
opentext, it treats the carriage return as if it is the beginning of a new
record and everything goes haywire. are there specific paramters i can pass
in with opentext to have it do what the program does when i drag and drop??
thanks.

okaizawa

opentext command
 
Hi,

Open method might be equivalent to dragging a file.
try:
Workbooks.Open "your_file_name.dat"

however, Open method doesn't have the same options as OpenText.
i wonder if it would do what you want actually...

--
HTH,

okaizawa


Ramesh Narasimhan wrote:
I am trying to open a text file as part of the workbook_open event handler.
when i manually import the text by dragging the .dat file into the workbook,
it (correctly) neglects carriage returns within fields, writing them as a
hollow square. However, when I import the text through the VBA command
opentext, it treats the carriage return as if it is the beginning of a new
record and everything goes haywire. are there specific paramters i can pass
in with opentext to have it do what the program does when i drag and drop??
thanks.



All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com