ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Good way to open a .txt file, copy/paste all text into Excel? (https://www.excelbanter.com/excel-programming/443635-good-way-open-txt-file-copy-paste-all-text-into-excel.html)

SS[_5_]

Good way to open a .txt file, copy/paste all text into Excel?
 
All,
What is a good way to open a .txt file, select all (it's all text),
copy.... then paste into an empty excel sheet; using VBA code?

Here's the situation:
I would like to run this sub when the workbook opens. The location
and name of the .txt file are always the same. I just need to simply
select all in txt file, copy, then regular paste into an excel sheet.
However, i will need to code past the question pop-up in excel about
the 'Data on the Clipboard is not the same size and shape...." .
clicking ok to that pop-up gives me what i want. Then close the .txt
file.

Any help would be greatly appreciated.

Thanks,
Steve

Don Guillett Excel MVP

Good way to open a .txt file, copy/paste all text into Excel?
 
On Sep 21, 1:55*pm, SS wrote:
All,
What is a good way to open a .txt file, select all (it's all text),
copy.... * then paste into an empty excel sheet; using VBA code?

Here's the situation:
I would like to run this sub when the workbook opens. *The location
and name of the .txt file are always the same. *I just need to simply
select all in txt file, copy, then regular paste into an excel sheet.
However, i will need to code past the question pop-up in excel about
the 'Data on the Clipboard is not the same size and shape...." .
clicking ok to that pop-up gives me what i want. *Then close the .txt
file.

Any help would be greatly appreciated.

Thanks,
Steve


Have you tried a simple recording of a macro while doing it?

Gord Dibben[_2_]

Good way to open a .txt file, copy/paste all text into Excel?
 
Have you tried the macro recorder?

If so, what results did you get and what improvements do you need?

Might be easier to simply open the *.txt file directly with Excel??


Gord Dibben MS Excel MVP


On Tue, 21 Sep 2010 11:55:01 -0700 (PDT), SS wrote:

All,
What is a good way to open a .txt file, select all (it's all text),
copy.... then paste into an empty excel sheet; using VBA code?

Here's the situation:
I would like to run this sub when the workbook opens. The location
and name of the .txt file are always the same. I just need to simply
select all in txt file, copy, then regular paste into an excel sheet.
However, i will need to code past the question pop-up in excel about
the 'Data on the Clipboard is not the same size and shape...." .
clicking ok to that pop-up gives me what i want. Then close the .txt
file.

Any help would be greatly appreciated.

Thanks,
Steve


SS[_5_]

Good way to open a .txt file, copy/paste all text into Excel?
 
On Sep 21, 3:36*pm, Gord Dibben wrote:
Have you tried the macro recorder?

If so, what results did you get and what improvements do you need?

Might be easier to simply open the *.txt file directly with Excel??

Gord Dibben * * MS Excel MVP



On Tue, 21 Sep 2010 11:55:01 -0700 (PDT), SS wrote:
All,
What is a good way to open a .txt file, select all (it's all text),
copy.... * then paste into an empty excel sheet; using VBA code?


Here's the situation:
I would like to run this sub when the workbook opens. *The location
and name of the .txt file are always the same. *I just need to simply
select all in txt file, copy, then regular paste into an excel sheet.
However, i will need to code past the question pop-up in excel about
the 'Data on the Clipboard is not the same size and shape...." .
clicking ok to that pop-up gives me what i want. *Then close the .txt
file.


Any help would be greatly appreciated.


Thanks,
Steve- Hide quoted text -


- Show quoted text -


I wasn't thinking to open within excel and convert it. Looks like
using the Import External Data option will work great in this case.

Many Thanks for the replies!!

C ya,
Steve



All times are GMT +1. The time now is 06:09 PM.

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