![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jul 2005
Posts: 2
Rep Power: 0
![]() |
Working with Notepad
Hello all,
I'm new to the forum and pretty new to programming too. I'm trying to work on a problem that is pretty difficult for me. Hope one of you guys can help me. Here's what I'm trying to do - I have a list of words in an excel sheet. I'd like to open an existing text file and compare the list of words (in excel) with the words in the notepad file and prompt if there is a word that does not match with any word in the list. I know how to open a notepad file and other basic stuff. any help will be appreciated. Thanks! |
|
|
|
|
|
#2 |
|
PFO Founder
![]() ![]() |
Are you creating this with VBA? or in other words the visual basic that is built into excel? or with just plain old normal VB?
edit: Just so you know its not really working with notepad. you will end up reading the plain text file(or as you called it Notepad file) and reading it into the program. here is a quick search on reading in text files into vba http://www.google.com/search?hs=HZU&...le&btnG=Search here is a quick search on reading in text files into vb6 http://www.google.com/search?hs=PZU&...le&btnG=Search just let me know which of the 2 you are using and i will get back to helping you more ![]()
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4
![]() |
Make the plain text file tab-delimited and then export the excel file as a tab-delimited text file and just parse through the files simultaneously comparing each token as you go.
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand." - B. Russell http://web.bryant.edu/~srk2 |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Jul 2005
Posts: 2
Rep Power: 0
![]() |
BigK and Skuinders - Thanks for the reply. sorry I could not get back earlier - I currently have computer access only at my office. BigK, I'm using VBA with Excel. I checked out the links and I'm going to try to do what it says. MEanwhile, it'd be of great help if you can help me out with the actual comparison part. I cannot think of anything other than sequentially checking every single word and since the text file is pretty large I'm worried about the time. Skuinders, I can visualize what you are saying but I'm pretty sure I cannot translate it into code.
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() |
you might be able to do the search useing regular experssions, if VBA has them.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
What skuinders is saying is that you can export the excel file as a text file. This means you don't have to understand the way VBA is used specifically for excel (as a macro language, so to speak). Obviously you have to look at every word. How else can you make a judgement about it? Just sort both files. Pick a word from file A. If the next word in file B is "greater", then the A word is not in File B. If it's not "greater", then continue to read from file A until you find a word in file B which is "equal" or "less". You see the drill.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|