p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   Working with .txt files (http://p2p.wrox.com/showthread.php?t=18226)

ArtDecade September 10th, 2004 04:50 PM

Working with .txt files
 
I'm embarrassed to ask, but I'm stumped....

How do I open a .txt file and then manipulate the text? Is it simply a matter of referencing a library, or does it get more complicated than that? I am trying to automate a search and replace within a .txt file. I had a procedure that used SENDKEYS, but now that my PC has been upgraded to Windows XP/2003 my old VBA doesn't work anymore.

This can't be hard to do, can it?



ArtDecade

jmaronilla September 10th, 2004 05:22 PM

What application will you be using excel or access?
if you will be using excel:
1. Open file with Excel for windows.
2. Click on the first column heading. This will hightlight the first column of the spreadsheet.
3. From the File menu select Data --> Text to Columns...
4. Choose Delimited and next.
5. Check tab, comma or however it fits you.
6. Your datas should now have diff. columns.
7. Select finish.

if you will be using access:
1. Open access app.
2. Select File --> Get external data --> import
3. Select the textfile.
4. continue

Hope this helps.
John



ArtDecade September 10th, 2004 10:05 PM

I may not have been clear in my initial post.

I have a text file that has a big chunk in the middle of it that I must replace with another big chunk. I am trying to automate the copy and paste process that I have used NotePad to accomplish. In my original procedure I used SHELL to open NotePad and then used SENDKEYS to highlight what I wanted in file #1. I would copy that to the clipboard and paste in into file #2 - again using the very inelegant SENDKEYS approach.

ArtDecade


All times are GMT -4. The time now is 12:36 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.