Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default 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?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are the Copy and Paste preferences in Excel not as good as Wor Dan Nichols Excel Discussion (Misc queries) 3 August 22nd 06 11:08 PM
Excel Macro to open file, load & do charts, functional but not usable/not a good prog osman[_2_] Excel Programming 0 May 16th 06 02:18 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Open file, copy field and paste into an Excel doc! - Pl help .. Harish Mohanbab Excel Programming 2 August 4th 05 04:24 PM
Open file, Copy a column and paste this into a new Excel doc - Pl Harish Mohanbabu[_2_] Excel Programming 1 August 4th 05 01:58 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"