first i'd like to thank all persons who helped me in my project
and i need someone help me to solve this
i have two notepad files
outfile.txt
testoutfile.txt
what i want to do is to insert some lines from outfile.txt to testoutfile.txt
Explaination:
start with outfile.txt insert every line in testoutfile.txt
if you reach the word solution skip this line in outfile.txt and skip a line in testoutfile.txt then continue inserting
do the same to the rest of lines
i attached a samlpe file to the formating of the file i need sample.txt
i ran the code i still had that i did before, the result file is attached
you must have changed the code slightly
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
As I understood the task is that you want all the lines from outfile.txt exemt those that contain the word "solution", instead of those you want a empty line. However your sample.txt is looking like the outfile.txt!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button Wait, I'm too old to hurry!
Last edited by westconn1; Nov 28th, 2006 at 06:25 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
westconn1 i tried this code
i got the same output in case of few word
and an error pointing to this line in case of paragraphs
(subscript out of range)
VB Code:
Print #f1, Mid(arrsecond(i), 1, pos); arrfirst(j); Mid(arrsecond(i), pos1, Len(arrsecond(i)) - pos1 + 1) ' print the line to file, with replacement
try it with the same files i was usng, these are the files i was using to write the code, the files of course came from you to start with, and process with no errors
a subscript out of range error means that one of the arrays has gone past its end, check to number of elements in each array, if the number of repacements is not enough for the number of strings to be replaced, you will get that error
Last edited by westconn1; Nov 28th, 2006 at 07:30 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
can you post the exact code you are using, or better still your project and i will see if i can see why you are getting different result
i make a new project, copy and paste the code into it, under a command button, presto, this file
i have made no changes to the code at all, so i can not say why it is not working for you
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
opus, you need to have the output file contain the arabic words that are in the original file, if you just print to file the arabic is translated unless you use ucode marker in the file,
as you have not opened the file with the arabic words for reading i don't see how this can work at all, though maybe i am missing something
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Maybe I don't get it,but I was only answering the question from this threat:
what i want to do is to insert some lines from outfile.txt to testoutfile.txt
Explaination:
start with outfile.txt insert every line in testoutfile.txt
if you reach the word solution skip this line in outfile.txt and skip a line in testoutfile.txt then continue inserting
do the same to the rest of lines
Now that I looked into that other threat, it seems to me, this question doesn't give to whole picture!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button Wait, I'm too old to hurry!
Now that I looked into that other threat, it seems to me, this question doesn't give to whole picture!
quite right
the suggestion here was to replace the whole line from one file with the line from the other, the original thread was to just replace a single word from a second file into the brackets in the first file, this was initially simple, except the arabic did not save in the text file, but converted into (f....??) or some such thing,
if you feel so inclined, test my code posted at the end of the other thread with the input files posted in #10 here, to see if you get the correct output, i originally wrote the code in VBA so just in case that was a problem did a new project today in vb and it all worked fine again, but as om is still having a problem it would be good if someone else can test it too
regards
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete