Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Does anyone have code that will show me how to read a file in reverse from the end of the file towards the beginning of the file. I have to find out if an exact phrase such as "the morning brings another day exists in a file. I am planning on using "Instr" to do this. I do not want to use FileSearch's "keyword" search capability because blanks in the phrase causes too many matches. I.E.: FileSearch will say a file has the phrase if the file has the words all over the place in a large file! Thank you, Chris |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() A bit more clarification, especially "file in reverse" I might assume that you mean you want to look in the last sheet, by location, first.????? -- Don Guillett Microsoft MVP Excel SalesAid Software "ChristopherL" wrote in message ... Hello, Does anyone have code that will show me how to read a file in reverse from the end of the file towards the beginning of the file. I have to find out if an exact phrase such as "the morning brings another day exists in a file. I am planning on using "Instr" to do this. I do not want to use FileSearch's "keyword" search capability because blanks in the phrase causes too many matches. I.E.: FileSearch will say a file has the phrase if the file has the words all over the place in a large file! Thank you, Chris |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you means reverse by Row or Char.acters.
For Rows add numbers to an auxilary column and then sort decreasing on th eauxilary column. Put 1 in row 1 and 2 in row 2. Then highlight both cells and pull down the little square box in the bottom right corner of the highlighted cells to number al the rows. Then sort on this new row To read a file backward by characters use ReadAll to read the entire file into a variable. then pull the characters out of the string backward like below. Const ReadFile = "c:\temp\event.txt" Const ForReading = 1, ForWriting = 2, _ ForAppending = 3 Set fs = CreateObject("Scripting.FileSystemObject") Set fin = fs.OpenTextFile(ReadFile, _ ForReading, TristateFalse) Data = fin.readall for i = len(Data) to 1 step -1 MyChar = mid(Data,i,1) next i "Don Guillett" wrote: A bit more clarification, especially "file in reverse" I might assume that you mean you want to look in the last sheet, by location, first.????? -- Don Guillett Microsoft MVP Excel SalesAid Software "ChristopherL" wrote in message ... Hello, Does anyone have code that will show me how to read a file in reverse from the end of the file towards the beginning of the file. I have to find out if an exact phrase such as "the morning brings another day exists in a file. I am planning on using "Instr" to do this. I do not want to use FileSearch's "keyword" search capability because blanks in the phrase causes too many matches. I.E.: FileSearch will say a file has the phrase if the file has the words all over the place in a large file! Thank you, Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro code to put series name next to individual line in line grap | Charts and Charting in Excel | |||
Read value from text file line, process, then Loop until EOF | Excel Programming | |||
How can i read Command Line parametres from Excel 2003 file??? | Excel Programming | |||
Textbox-read text line by line | Excel Programming | |||
read last line of a file | Excel Programming |