Wrox Programmer Forums
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 10th, 2004, 04:50 PM
Authorized User
Join Date: Jul 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?

Old September 10th, 2004, 05:22 PM
Friend of Wrox
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post

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.

Old September 10th, 2004, 10:05 PM
Authorized User
Join Date: Jul 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
WHERE IS THE TXT FILES OF BOOK? PedroPN BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 2 July 5th, 2007 10:32 AM
Uploading txt files arnabghosh Classic ASP Basics 1 June 15th, 2005 04:44 PM
where to put startup txt files mp VB.NET 2002/2003 Basics 2 March 24th, 2005 09:34 AM
data from txt files to access db citizen99 Access VBA 3 January 25th, 2005 12:50 PM
Linked Tables to non *.TXT files chrislepingwell Access 0 July 21st, 2004 07:05 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.