This subroutine would take an ascii text file, sort it based on various parameters, and output it to another or the same file.
MUST be able to run as a macro in Excel2000/XP under Windows 2000/XP
Subroutine Params:
Public Sub SortFile(
byvar InputFullPathAndFilename as string,
byvar OutputFullPathAndFilename as string,
byvar NumLinesToSkipAtBeginning as long,
byvar NumLinesToSkipAtEnd as long,
byvar SortCol1 as long,
byvar SortLength1 as long,
byvar SortDirection1 as string,
byvar SortCol2 as long,
byvar SortLength2 as long,
byvar SortDirection2 as string,
byvar SortCol3 as long,
byvar SortLength3 as long,
byvar SortDirection3 as string,
)
Field Descs:
InputFullPathAndFilename - full pathname of the input file
OutputFullPathAndFilename - full pathname of the input file.(this can be the same as input file, and if it is, just write over the input file)
NumLinesToSkipAtBeginning - if this number is other than 0, then sorting won't start until after this line number, but these lines will still be output to the beginning of the output file.
NumLinesToSkipAtEnd - if this number is other than 0, then sorting will not include the last NumLinesToSkipAtEnd lines, but these lines will still be output to the end of the output file.
SortCol1 - The column/character where the first level sort starts.
SortLength1 - The number of characters in the first level sort
SortDirection1 - This will be "A" for Ascending or "D" for Descending sort
SortCol2 - for the 2nd level sort, if 0, then there is no 2nd level sort
SortLength2 - for the 2nd level sort
SortDirection2 - for the 2nd level sort
SortCol3 - for the 3rd level sort, if 0, then there is no 3rd level sort
SortLength3 - for the 3rd level sort
SortDirection3 - for the 3rd level sort
All sorting will be ascii text order based.
This needs to be finished within one day after the bid is awarded.
Do not use Shell, any outside libraries, or worksheets (even if hidden)... it all MUST be done in VBA.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
4) Delivery must be in an Excel2000 workbook as a subroutine in that workbook.
5) In the zip file, you will find an ASCII text file to use for sorting. Test it with these function calls:
Call SortFile("C:\[login to view URL]", "C:\[login to view URL]",
1, 5,
11, 5, "A",
0, 0, "",
0, 0, "")
Call SortFile("C:\[login to view URL]", "C:\[login to view URL]",
1, 5
22, 1, "A",
1, 8, "D",
11, 5, "A")
## Platform
Win2000/XP and Excel2000/XP