By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

Trying to Compare 2 txt files using VB Script

P: 1
I've never writen any VB Script before and need as much help as i can get with this issue. I need a VB Script that will do the following:

Expand|Select|Wrap|Line Numbers
  1. open TxtFile1.csv
  2. for each line in file
  3.       save visit ID into array 
  4. close TxtFile1.csv
  5. for each visit ID in array
  6.       search txtFile2 for match
  7.       if match
  8.             save entry into new file
Any help with this would be much appreciated!
Apr 30 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
I've never writen any VB Script before and need as much help as i can get with this issue. I need a VB Script that will do the following:

Expand|Select|Wrap|Line Numbers
  1. open TxtFile1.csv
  2. for each line in file
  3.       save visit ID into array 
  4. close TxtFile1.csv
  5. for each visit ID in array
  6.       search txtFile2 for match
  7.       if match
  8.             save entry into new file
Any help with this would be much appreciated!
Well, let's see. To open the file you can use the Open statement (funny, that).
Then something like a Do Until Eof(filenumber) loop, and Line Input #filenumber, StringVariable to read your CSV file. The Split() function can be used to pick apart each line into fields (presumably splitting on commas).
To resize an array to make room for another entry, use ReDim Preserve.

Is that any help in getting you started?
Apr 30 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.