Tram88 wrote:
Based on your code, I do have a question for intTotalCount = CountStringInFile(strFileEmailNotification, estringtext) If I run the code, I would like to see intTotalCount=1 . In fact, it is 2. Can you teach me how to program it.
The CountStringInFile()
function is not a standard VB function call. I presume you have obtained this code from somewhere else? If it does what its name implies, then it will scan the entire file for any occurrences of the search string - in this particular case with the data you have already supplied in your first post, there are two lines which contain "Error" therefore the return value will be 2. What I think you need to do is to change this line:
intTotalCount = CountStringInFile(strFileEmailNotification, estringtext)
to
eIntotalCount = eIntotalCount + 1
since intTotalCount
does not seem to be declared anywhere and eIntotalCount
is declared but not used. [Was this intentional?] When your code exits, eIntotalCount
will now contain the count of the number of lines in your file that have both the error string AND the date string for which you are searching.
...Steve
1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)